intriduce DB version (again) so we can keep release-version numbers while updating the database; added enable/disable switch for Let's Encrypt

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2016-03-07 13:47:22 +01:00
parent 9d6ee0d08f
commit 604f37bd17
16 changed files with 149 additions and 36 deletions

View File

@@ -524,6 +524,7 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES
('system', 'letsencryptchallengepath', '/var/www/froxlor'),
('system', 'letsencryptkeysize', '4096'),
('system', 'letsencryptreuseold', 0),
('system', 'leenabled', '0'),
('panel', 'decimal_places', '4'),
('panel', 'adminmail', 'admin@SERVERNAME'),
('panel', 'phpmyadmin_url', ''),
@@ -554,7 +555,8 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES
('panel', 'password_numeric', '0'),
('panel', 'password_special_char_required', '0'),
('panel', 'password_special_char', '!?<>§$%+#=@'),
('panel', 'version', '0.9.35-rc1');
('panel', 'version', '0.9.35-rc1'),
('panel', 'db_version', '201603070');
DROP TABLE IF EXISTS `panel_tasks`;

View File

@@ -3144,3 +3144,20 @@ if (isFroxlorVersion('0.9.35-dev7')) {
updateToVersion('0.9.35-rc1');
}
if (isFroxlorVersion('0.9.35-rc1')) {
Settings::AddNew("panel.db_version", "201603070");
showUpdateStep("Removing unused table and fields from database");
Database::query("DROP TABLE IF EXISTS `panel_vhostconfigs`;");
Database::query("ALTER TABLE `" . TABLE_PANEL_DOMAINS ."` DROP `vhost_usedefaultlocation`;");
Database::query("ALTER TABLE `" . TABLE_PANEL_DOMAINS ."` DROP `vhostsettingid`;");
lastStepStatus(0);
showUpdateStep("Adding new setting to enable/disable Let's Encrypt");
$enable_letsencrypt = isset($_POST['enable_letsencrypt']) ? (int)$_POST['enable_letsencrypt'] : "1";
Settings::AddNew("system.leenabled", $enable_letsencrypt);
lastStepStatus(0);
}

View File

@@ -21,17 +21,18 @@
* outputs various content before the update process
* can be continued (askes for agreement whatever is being asked)
*
* @param string version
* @param string $current_version
* @param int $current_db_version
*
* @return string
*/
function getPreConfig($current_version)
function getPreConfig($current_version, $current_db_version)
{
$has_preconfig = false;
$return = '<div class="preconfig"><h3 class="red">PLEASE NOTE - Important update notifications</h3>';
include_once makeCorrectFile(dirname(__FILE__).'/preconfig/0.9/preconfig_0.9.inc.php');
parseAndOutputPreconfig($has_preconfig, $return, $current_version);
parseAndOutputPreconfig($has_preconfig, $return, $current_version, $current_db_version);
$return .= '<br /><br />'.makecheckbox('update_changesagreed', '<strong>I have read the update notifications above and I am aware of the changes made to my system.</strong>', '1', true, '0', true);
$return .= '</div>';

View File

@@ -24,7 +24,7 @@
*
* @return null
*/
function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version) {
function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version, $current_db_version) {
global $lng;
@@ -700,4 +700,12 @@ function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version) {
$question .= '<br>';
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
}
if (versionInUpdate($current_db_version, '201603070')) {
$has_preconfig = true;
$description = 'You can chose whether you want to enable or disable our Let\'s Encrypt implementation.<br /><br />';
$question = '<strong>Do you want to enable Let\'s Encrypt? (default: yes):</strong>&nbsp;';
$question.= makeyesno('enable_letsencrypt', '1', '0', '1').'<br />';
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
}
}