add new setting to preselect system distribution to ease configuration

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2022-04-30 14:01:49 +02:00
parent 14c86d3d21
commit e768d834c1
6 changed files with 44 additions and 2 deletions

View File

@@ -43,6 +43,11 @@ if ($userinfo['change_serversettings'] == '1') {
// get distro from URL param
$distribution = Request::get('distribution');
// check for possible setting
if (empty($distribution)) {
$distribution = Settings::Get('system.distribution') ?? "";
}
$distributions_select = [];
$services = [];
@@ -53,6 +58,11 @@ if ($userinfo['change_serversettings'] == '1') {
Response::dynamicError("Unknown distribution");
}
// update setting if different
if ($distribution != Settings::Get('system.distribution')) {
Settings::Set('system.distribution', $distribution);
}
// create configparser object
$configfiles = new ConfigParser($config_dir . '/' . $distribution . ".xml");

View File

@@ -699,6 +699,7 @@ opcache.validate_timestamps'),
('system', 'froxlorusergroup', ''),
('system', 'froxlorusergroup_gid', ''),
('system', 'acmeshpath', '/root/.acme.sh/acme.sh'),
('system', 'distribution', ''),
('api', 'enabled', '0'),
('2fa', 'enabled', '1'),
('panel', 'decimal_places', '4'),

View File

@@ -126,6 +126,8 @@ if (Froxlor::isFroxlorVersion('0.10.99')) {
Update::showUpdateStep("Adding new settings");
$panel_settings_mode = isset($_POST['panel_settings_mode']) ? (int) $_POST['panel_settings_mode'] : 0;
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::showUpdateStep("Adjusting existing settings");

View File

@@ -15,6 +15,10 @@
*
*/
use Froxlor\Froxlor;
use Froxlor\FileDir;
use Froxlor\Config\ConfigParser;
/**
* checks if the new-version has some updating to do
*
@@ -29,7 +33,6 @@
*/
function parseAndOutputPreconfig011(&$has_preconfig, &$return, $current_version, $current_db_version)
{
global $lng;
if (versionInUpdate($current_version, '0.10.99')) {
$has_preconfig = true;
@@ -45,5 +48,28 @@ function parseAndOutputPreconfig011(&$has_preconfig, &$return, $current_version,
'selected' => 1,
'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
];
}
}

View File

@@ -1354,6 +1354,9 @@ Yours sincerely, your administrator',
'maintitle' => 'PHP Configurations',
'fpmdaemons' => 'PHP-FPM versions',
],
'logger' => [
'logger' => 'System log',
],
],
'message' => [
'norecipients' => 'No e-mail has been sent because there are no recipients in the database',