add new setting to preselect system distribution to ease configuration
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
@@ -43,6 +43,11 @@ if ($userinfo['change_serversettings'] == '1') {
|
|||||||
// get distro from URL param
|
// get distro from URL param
|
||||||
$distribution = Request::get('distribution');
|
$distribution = Request::get('distribution');
|
||||||
|
|
||||||
|
// check for possible setting
|
||||||
|
if (empty($distribution)) {
|
||||||
|
$distribution = Settings::Get('system.distribution') ?? "";
|
||||||
|
}
|
||||||
|
|
||||||
$distributions_select = [];
|
$distributions_select = [];
|
||||||
|
|
||||||
$services = [];
|
$services = [];
|
||||||
@@ -53,6 +58,11 @@ if ($userinfo['change_serversettings'] == '1') {
|
|||||||
Response::dynamicError("Unknown distribution");
|
Response::dynamicError("Unknown distribution");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// update setting if different
|
||||||
|
if ($distribution != Settings::Get('system.distribution')) {
|
||||||
|
Settings::Set('system.distribution', $distribution);
|
||||||
|
}
|
||||||
|
|
||||||
// create configparser object
|
// create configparser object
|
||||||
$configfiles = new ConfigParser($config_dir . '/' . $distribution . ".xml");
|
$configfiles = new ConfigParser($config_dir . '/' . $distribution . ".xml");
|
||||||
|
|
||||||
|
|||||||
@@ -699,6 +699,7 @@ opcache.validate_timestamps'),
|
|||||||
('system', 'froxlorusergroup', ''),
|
('system', 'froxlorusergroup', ''),
|
||||||
('system', 'froxlorusergroup_gid', ''),
|
('system', 'froxlorusergroup_gid', ''),
|
||||||
('system', 'acmeshpath', '/root/.acme.sh/acme.sh'),
|
('system', 'acmeshpath', '/root/.acme.sh/acme.sh'),
|
||||||
|
('system', 'distribution', ''),
|
||||||
('api', 'enabled', '0'),
|
('api', 'enabled', '0'),
|
||||||
('2fa', 'enabled', '1'),
|
('2fa', 'enabled', '1'),
|
||||||
('panel', 'decimal_places', '4'),
|
('panel', 'decimal_places', '4'),
|
||||||
|
|||||||
@@ -126,6 +126,8 @@ if (Froxlor::isFroxlorVersion('0.10.99')) {
|
|||||||
Update::showUpdateStep("Adding new settings");
|
Update::showUpdateStep("Adding new settings");
|
||||||
$panel_settings_mode = isset($_POST['panel_settings_mode']) ? (int) $_POST['panel_settings_mode'] : 0;
|
$panel_settings_mode = isset($_POST['panel_settings_mode']) ? (int) $_POST['panel_settings_mode'] : 0;
|
||||||
Settings::AddNew("panel.settings_mode", $panel_settings_mode);
|
Settings::AddNew("panel.settings_mode", $panel_settings_mode);
|
||||||
|
$system_distribution = isset($_POST['system_distribution']) ? $_POST['system_distribution'] : '';
|
||||||
|
Settings::AddNew("system.distribution", $system_distribution);
|
||||||
Update::lastStepStatus(0);
|
Update::lastStepStatus(0);
|
||||||
|
|
||||||
Update::showUpdateStep("Adjusting existing settings");
|
Update::showUpdateStep("Adjusting existing settings");
|
||||||
|
|||||||
@@ -15,6 +15,10 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use Froxlor\Froxlor;
|
||||||
|
use Froxlor\FileDir;
|
||||||
|
use Froxlor\Config\ConfigParser;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* checks if the new-version has some updating to do
|
* checks if the new-version has some updating to do
|
||||||
*
|
*
|
||||||
@@ -29,7 +33,6 @@
|
|||||||
*/
|
*/
|
||||||
function parseAndOutputPreconfig011(&$has_preconfig, &$return, $current_version, $current_db_version)
|
function parseAndOutputPreconfig011(&$has_preconfig, &$return, $current_version, $current_db_version)
|
||||||
{
|
{
|
||||||
global $lng;
|
|
||||||
|
|
||||||
if (versionInUpdate($current_version, '0.10.99')) {
|
if (versionInUpdate($current_version, '0.10.99')) {
|
||||||
$has_preconfig = true;
|
$has_preconfig = true;
|
||||||
@@ -45,5 +48,28 @@ function parseAndOutputPreconfig011(&$has_preconfig, &$return, $current_version,
|
|||||||
'selected' => 1,
|
'selected' => 1,
|
||||||
'label' => $question
|
'label' => $question
|
||||||
];
|
];
|
||||||
|
|
||||||
|
$description = 'The configuration page now can preselect a distribution, please select your current distribution';
|
||||||
|
$return['system_distribution_note'] = ['type' => 'infotext', 'value' => $description];
|
||||||
|
$question = '<strong>Select distribution</strong>';
|
||||||
|
$config_dir = FileDir::makeCorrectDir(Froxlor::getInstallDir() . '/lib/configfiles/');
|
||||||
|
// show list of available distro's
|
||||||
|
$distros = glob($config_dir . '*.xml');
|
||||||
|
$distributions_select[''] = '-';
|
||||||
|
// read in all the distros
|
||||||
|
foreach ($distros as $_distribution) {
|
||||||
|
// get configparser object
|
||||||
|
$dist = new ConfigParser($_distribution);
|
||||||
|
// store in tmp array
|
||||||
|
$distributions_select[str_replace(".xml", "", strtolower(basename($_distribution)))] = $dist->getCompleteDistroName();
|
||||||
|
}
|
||||||
|
// sort by distribution name
|
||||||
|
asort($distributions_select);
|
||||||
|
$return['system_distribution'] = [
|
||||||
|
'type' => 'select',
|
||||||
|
'select_var' => $distributions_select,
|
||||||
|
'selected' => '',
|
||||||
|
'label' => $question
|
||||||
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ final class RunApiCommand extends CliCommand
|
|||||||
} else {
|
} else {
|
||||||
$rows = [];
|
$rows = [];
|
||||||
foreach ($docs['params'] as $param) {
|
foreach ($docs['params'] as $param) {
|
||||||
$rows[] = [$param['type'], '<options=bold>'.$param['parameter'].'</>', $param['desc'] ?? ""];
|
$rows[] = [$param['type'], '<options=bold>' . $param['parameter'] . '</>', $param['desc'] ?? ""];
|
||||||
}
|
}
|
||||||
$io->table(['Type', 'Name', 'Description'], $rows);
|
$io->table(['Type', 'Name', 'Description'], $rows);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1354,6 +1354,9 @@ Yours sincerely, your administrator',
|
|||||||
'maintitle' => 'PHP Configurations',
|
'maintitle' => 'PHP Configurations',
|
||||||
'fpmdaemons' => 'PHP-FPM versions',
|
'fpmdaemons' => 'PHP-FPM versions',
|
||||||
],
|
],
|
||||||
|
'logger' => [
|
||||||
|
'logger' => 'System log',
|
||||||
|
],
|
||||||
],
|
],
|
||||||
'message' => [
|
'message' => [
|
||||||
'norecipients' => 'No e-mail has been sent because there are no recipients in the database',
|
'norecipients' => 'No e-mail has been sent because there are no recipients in the database',
|
||||||
|
|||||||
Reference in New Issue
Block a user