merge branch '0.11-dev' of github.com:Froxlor/Froxlor into 0.11-dev

This commit is contained in:
envoyr
2022-05-01 17:27:36 +02:00
15 changed files with 226 additions and 171 deletions

View File

@@ -87,6 +87,11 @@ if (Froxlor::isFroxlorVersion('0.10.99')) {
$to_clean = array(
"install/lib",
"install/lng",
"install/updates/froxlor/0.9",
"install/updates/froxlor/0.10",
"install/updates/preconfig/0.9",
"install/updates/preconfig/0.10",
"install/updates/preconfig.php",
"templates/Sparkle",
"lib/version.inc.php",
"lng/czech.lng.php",

View File

@@ -1,80 +0,0 @@
<?php
/**
* This file is part of the Froxlor project.
* Copyright (c) 2010 the Froxlor Team (see authors).
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
*
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/
use Froxlor\Froxlor;
use Froxlor\FileDir;
/**
* Function getPreConfig
*
* outputs various form-field-arrays before the update process
* can be continued (asks for agreement whatever is being asked)
*
* @param string $current_version
* @param int $current_db_version
*
* @return array
*/
function getPreConfig($current_version, $current_db_version): array
{
$has_preconfig = false;
include_once FileDir::makeCorrectFile(dirname(__FILE__) . '/preconfig/0.11/preconfig_0.11.inc.php');
$return['section_011'] = [
'title' => '0.11.x updates',
'fields' => []
];
parseAndOutputPreconfig011($has_preconfig, $return['section_011']['fields'], $current_version, $current_db_version);
if (empty($return['section_011']['fields'])) {
unset($return['section_011']);
}
if (!empty($return)) {
$has_preconfig = true;
$return['section_agree'] = [
'title' => 'Check',
'fields' => [
'update_changesagreed' => ['type' => 'checkbox', 'value' => 1, 'label' => '<strong>I have read the update notifications above and I am aware of the changes made to my system.</strong>'],
'update_preconfig' => ['type' => 'hidden', 'value' => 1]
]
];
}
if ($has_preconfig) {
return $return;
} else {
return [];
}
}
function versionInUpdate($current_version, $version_to_check)
{
if (!Froxlor::isFroxlor()) {
return true;
}
return Froxlor::versionCompare2($current_version, $version_to_check) == -1;
}

View File

@@ -1,75 +0,0 @@
<?php
/**
* This file is part of the Froxlor project.
* Copyright (c) 2010 the Froxlor Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at https://files.froxlor.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 https://files.froxlor.org/misc/COPYING.txt
* @package Updater
*
*/
use Froxlor\Froxlor;
use Froxlor\FileDir;
use Froxlor\Config\ConfigParser;
/**
* checks if the new-version has some updating to do
*
* @param boolean $has_preconfig
* pointer to check if any preconfig has to be output
* @param string $return
* pointer to output string
* @param string $current_version
* current froxlor version
*
* @return void
*/
function parseAndOutputPreconfig011(&$has_preconfig, &$return, $current_version, $current_db_version)
{
if (versionInUpdate($current_version, '0.10.99')) {
$has_preconfig = true;
$description = 'We have rearranged the settings and split them into basic and advanced categories. This makes it easier for users who do not need all the detailed or very specific settings and options and gives a better overview of the basic/mostly used settings.';
$return['panel_settings_mode_note'] = ['type' => 'infotext', 'value' => $description];
$question = '<strong>Chose settings mode (you can change that at any time)</strong>';
$return['panel_settings_mode'] = [
'type' => 'select',
'select_var' => [
0 => 'Basic',
1 => 'Advanced'
],
'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

@@ -0,0 +1,76 @@
<?php
/**
* This file is part of the Froxlor project.
* Copyright (c) 2010 the Froxlor Team (see authors).
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
*
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/
use Froxlor\Froxlor;
use Froxlor\FileDir;
use Froxlor\Config\ConfigParser;
use Froxlor\Install\Update;
$preconfig = [
'title' => '0.11.x updates',
'fields' => []
];
$return = [];
if (Update::versionInUpdate($current_version, '0.11.0-dev1')) {
$description = 'We have rearranged the settings and split them into basic and advanced categories. This makes it easier for users who do not need all the detailed or very specific settings and options and gives a better overview of the basic/mostly used settings.';
$return['panel_settings_mode_note'] = ['type' => 'infotext', 'value' => $description];
$question = '<strong>Chose settings mode (you can change that at any time)</strong>';
$return['panel_settings_mode'] = [
'type' => 'select',
'select_var' => [
0 => 'Basic',
1 => 'Advanced'
],
'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
];
}
$preconfig['fields'] = $return;
return $preconfig;

View File

@@ -24,7 +24,7 @@
*/
use Froxlor\Froxlor;
use Froxlor\Filedir;
use Froxlor\FileDir;
use Froxlor\FroxlorLogger;
use Froxlor\UI\Response;
use Froxlor\Database\IntegrityCheck;
@@ -55,7 +55,7 @@ if (Froxlor::isFroxlor()) {
$update_tasks = [];
$task_counter = 0;
include_once(FileDir::makeCorrectFile(dirname(__FILE__) . '/updates/froxlor/0.11/update_0.11.inc.php'));
include_once(FileDir::makeCorrectFile(dirname(__FILE__) . '/updates/froxlor/update_0.11.inc.php'));
// Check Froxlor - database integrity (only happens after all updates are done, so we know the db-layout is okay)
Update::showUpdateStep("Checking database integrity");