Skip to content

Commit

Permalink
little work on installation; replace hardcoded strings with variables…
Browse files Browse the repository at this point in the history
…/constants; update dependencies

Signed-off-by: Michael Kaufmann <[email protected]>
  • Loading branch information
d00p committed Nov 30, 2023
1 parent d80c6d5 commit 2684372
Show file tree
Hide file tree
Showing 13 changed files with 108 additions and 101 deletions.
144 changes: 73 additions & 71 deletions composer.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion customer_domains.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
}

$actions_links[] = [
'href' => 'https://docs.froxlor.org/v2/user-guide/domains/',
'href' => \Froxlor\Froxlor::DOCS_URL . 'user-guide/domains/',
'target' => '_blank',
'icon' => 'fa-solid fa-circle-info',
'class' => 'btn-outline-secondary'
Expand Down
4 changes: 2 additions & 2 deletions customer_email.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
}

$actions_links[] = [
'href' => 'https://docs.froxlor.org/v2/user-guide/emails/',
'href' => \Froxlor\Froxlor::DOCS_URL . 'user-guide/emails/',
'target' => '_blank',
'icon' => 'fa-solid fa-circle-info',
'class' => 'btn-outline-secondary'
Expand Down Expand Up @@ -138,7 +138,7 @@
];
}
$actions_links[] = [
'href' => 'https://docs.froxlor.org/v2/user-guide/emails/',
'href' => \Froxlor\Froxlor::DOCS_URL . 'user-guide/emails/',
'target' => '_blank',
'icon' => 'fa-solid fa-circle-info',
'class' => 'btn-outline-secondary'
Expand Down
6 changes: 3 additions & 3 deletions customer_extras.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
];

$actions_links[] = [
'href' => 'https://docs.froxlor.org/v2/user-guide/extras/',
'href' => \Froxlor\Froxlor::DOCS_URL . 'user-guide/extras/',
'target' => '_blank',
'icon' => 'fa-solid fa-circle-info',
'class' => 'btn-outline-secondary'
Expand Down Expand Up @@ -200,7 +200,7 @@
];

$actions_links[] = [
'href' => 'https://docs.froxlor.org/v2/user-guide/extras/',
'href' => \Froxlor\Froxlor::DOCS_URL . 'user-guide/extras/',
'target' => '_blank',
'icon' => 'fa-solid fa-circle-info',
'class' => 'btn-outline-secondary'
Expand Down Expand Up @@ -349,7 +349,7 @@

$actions_links = [
[
'href' => 'https://docs.froxlor.org/v2/user-guide/extras/',
'href' => \Froxlor\Froxlor::DOCS_URL . 'user-guide/extras/',
'target' => '_blank',
'icon' => 'fa-solid fa-circle-info',
'class' => 'btn-outline-secondary'
Expand Down
2 changes: 1 addition & 1 deletion customer_ftp.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
];
}
$actions_links[] = [
'href' => 'https://docs.froxlor.org/v2/user-guide/ftp-accounts/',
'href' => \Froxlor\Froxlor::DOCS_URL . 'user-guide/ftp-accounts/',
'target' => '_blank',
'icon' => 'fa-solid fa-circle-info',
'class' => 'btn-outline-secondary'
Expand Down
2 changes: 1 addition & 1 deletion customer_mysql.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
}

$actions_links[] = [
'href' => 'https://docs.froxlor.org/v2/user-guide/databases/',
'href' => \Froxlor\Froxlor::DOCS_URL . 'user-guide/databases/',
'target' => '_blank',
'icon' => 'fa-solid fa-circle-info',
'class' => 'btn-outline-secondary'
Expand Down
5 changes: 3 additions & 2 deletions lib/Froxlor/Cron/Http/LetsEncrypt/AcmeSh.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
namespace Froxlor\Cron\Http\LetsEncrypt;

use Froxlor\Cron\FroxlorCron;
use Froxlor\Cron\TaskId;
use Froxlor\Database\Database;
use Froxlor\Domain\Domain;
use Froxlor\FileDir;
Expand Down Expand Up @@ -83,7 +84,7 @@ public static function run(bool $internal = false)
$renew_domains = self::renewDomains(true);
if ($issue_froxlor || !empty($issue_domains) || !empty($renew_froxlor) || $renew_domains) {
// insert task to generate certificates and vhost-configs
Cronjob::inserttask(1);
Cronjob::inserttask(TaskId::REBUILD_VHOST);
}
return 0;
}
Expand Down Expand Up @@ -203,7 +204,7 @@ public static function run(bool $internal = false)
// This is easiest done by just creating a new task ;)
if ($changedetected) {
if (self::$no_inserttask == false) {
Cronjob::inserttask(1);
Cronjob::inserttask(TaskId::REBUILD_VHOST);
}
FroxlorLogger::getInstanceOf()->logAction(FroxlorLogger::CRON_ACTION, LOG_INFO, "Let's Encrypt certificates have been updated");
} else {
Expand Down
2 changes: 2 additions & 0 deletions lib/Froxlor/Froxlor.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ final class Froxlor
// Distribution branding-tag (used for Debian etc.)
const BRANDING = '';

const DOCS_URL = 'https://docs.froxlor.org/v2.1/';

/**
* return path to where froxlor is installed, e.g.
* /var/www/froxlor/
Expand Down
28 changes: 15 additions & 13 deletions lib/Froxlor/Install/Install.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,25 +48,31 @@ class Install
public array $supportedOS = [];
public array $webserverBackend = [
'php-fpm' => 'PHP-FPM',
'fcgid' => 'FCGID',
'fcgid' => 'FCGID (apache2 only)',
'mod_php' => 'mod_php (not recommended)',
];

public function __construct(array $cliData = [])
{
// set actual php version and extensions
$this->phpVersion = phpversion();
$this->loadedExtensions = get_loaded_extensions();

// get all supported OS
// show list of available distro's
$distros = glob(dirname(__DIR__, 3) . '/lib/configfiles/*.xml');
$distributions_select[''] = '-';
// read in all the distros
foreach ($distros as $distribution) {
// get configparser object
$dist = new ConfigParser($distribution);
// store in tmp array
$this->supportedOS[str_replace(".xml", "", strtolower(basename($distribution)))] = $dist->getCompleteDistroName();
if (in_array('xml', $this->loadedExtensions)) {
// read in all the distros
foreach ($distros as $distribution) {
// get configparser object
$dist = new ConfigParser($distribution);
// store in tmp array
$this->supportedOS[str_replace(".xml", "", strtolower(basename($distribution)))] = $dist->getCompleteDistroName();
}
// sort by distribution name
asort($this->supportedOS);
}
// sort by distribution name
asort($this->supportedOS);

// guess distribution and webserver to preselect in formfield
$webserverBackend = $this->webserverBackend;
Expand All @@ -82,10 +88,6 @@ public function __construct(array $cliData = [])
$this->extendedView = $cliData['extended'] ?? Request::any('extended', 0);
$this->maxSteps = count($this->formfield['install']['sections']);

// set actual php version and extensions
$this->phpVersion = phpversion();
$this->loadedExtensions = get_loaded_extensions();

if (empty($cliData)) {
// set global variables
UI::twig()->addGlobal('install_mode', true);
Expand Down
2 changes: 1 addition & 1 deletion lib/Froxlor/Install/Requirements.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
class Requirements
{
const REQUIRED_VERSION = '7.4.0';
const REQUIRED_EXTENSIONS = ['session', 'ctype', 'xml', 'filter', 'posix', 'mbstring', 'curl', 'gmp', 'json', 'gd'];
const REQUIRED_EXTENSIONS = ['session', 'ctype', 'xml', 'filter', 'posix', 'mbstring', 'pdo_mysql', 'curl', 'gmp', 'json', 'gd'];
const SUGGESTED_EXTENSIONS = ['bcmath', 'zip', 'gnupg'];
}
8 changes: 4 additions & 4 deletions lib/navigation/00.froxlor.main.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,13 @@
'show_element' => (!Settings::IsInList('panel.customer_hide_options', 'misc.documentation')),
'elements' => [
[
'url' => 'https://docs.froxlor.org/v2/user-guide/',
'url' => \Froxlor\Froxlor::DOCS_URL . 'user-guide/',
'label' => lng('admin.userguide'),
'new_window' => true,
'is_external' => true,
],
[
'url' => 'https://docs.froxlor.org/v2/api-guide/',
'url' => \Froxlor\Froxlor::DOCS_URL . 'api-guide/',
'label' => lng('admin.apiguide'),
'new_window' => true,
'show_element' => Settings::Get('api.enabled') == 1 && CurrentUser::getField('api_allowed') == 1,
Expand Down Expand Up @@ -348,13 +348,13 @@
'icon' => 'fa-solid fa-circle-info',
'elements' => [
[
'url' => 'https://docs.froxlor.org/v2/admin-guide/',
'url' => \Froxlor\Froxlor::DOCS_URL . 'admin-guide/',
'label' => lng('admin.adminguide'),
'new_window' => true,
'is_external' => true,
],
[
'url' => 'https://docs.froxlor.org/v2/api-guide/',
'url' => \Froxlor\Froxlor::DOCS_URL . 'api-guide/',
'label' => lng('admin.apiguide'),
'new_window' => true,
'show_element' => Settings::Get('api.enabled') == 1,
Expand Down
2 changes: 1 addition & 1 deletion lng/de.lng.php
Original file line number Diff line number Diff line change
Expand Up @@ -2243,7 +2243,7 @@
'database' => [
'top' => 'Datenbank',
'title' => 'Datenbank und Benutzer erstellen',
'description' => 'Froxlor benötigt eine Datenbank und zusätzlich einen Benutzer mit privilegierten Rechten, welcher Benutzer und Datenbanken erstellen darf (GRANT Option). Die angegebene Datenbank und der unprivilegierte Benutzer werden automatisch in diesem Prozess erstellt. Der privilegierte Benutzer muss existieren.',
'description' => 'Froxlor benötigt eine Datenbank und zusätzlich <a href="https://docs.froxlor.org/latest/general/installation/tarball.html#_3-create-privileged-database-user" target="_blank">einen Benutzer mit privilegierten Rechten</a>, welcher Benutzer und Datenbanken erstellen darf (GRANT Option). Die angegebene Datenbank und der unprivilegierte Benutzer werden automatisch in diesem Prozess erstellt. Der privilegierte Benutzer muss existieren.',
'user' => 'Unprivilegierter Datenbank Benutzer',
'dbname' => 'Datenbank Name',
'force_create' => 'Sichern und überschreiben, sofern Datenbank existiert?',
Expand Down
2 changes: 1 addition & 1 deletion lng/en.lng.php
Original file line number Diff line number Diff line change
Expand Up @@ -2379,7 +2379,7 @@
'database' => [
'top' => 'Database',
'title' => 'Create database and user',
'description' => 'Froxlor requires a database and additionally a privileged user to be able to create users and databases (GRANT option). The given database and unprivileged database-user will be created in this process. The privileged user must exist.',
'description' => 'Froxlor requires a database and additionally <a href="https://docs.froxlor.org/latest/general/installation/tarball.html#_3-create-privileged-database-user" target="_blank">a privileged user</a> to be able to create users and databases (GRANT option). The given database and unprivileged database-user will be created in this process. The privileged user must exist.',
'user' => 'Unprivileged database user',
'dbname' => 'Database name',
'force_create' => 'Backup and overwrite database if exists?',
Expand Down

0 comments on commit 2684372

Please sign in to comment.