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

@@ -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
];
}
}