From 7fa901bebb2704670da88ac54c68c817ac6476db Mon Sep 17 00:00:00 2001 From: "Michael Kaufmann (d00p)" Date: Wed, 14 Apr 2010 07:36:38 +0000 Subject: [PATCH] - improved update-procedure - updated version to 0.9.4-svn2 --- admin_updates.php | 2 +- install/froxlor.sql | 2 +- install/updates/preconfig.php | 27 ++++++++----- .../preconfig/0.9/preconfig_0.9.inc.php | 38 +++++++++++++++++++ lib/tables.inc.php | 2 +- 5 files changed, 58 insertions(+), 13 deletions(-) create mode 100644 install/updates/preconfig/0.9/preconfig_0.9.inc.php diff --git a/admin_updates.php b/admin_updates.php index 282ff757..d1bbdc04 100644 --- a/admin_updates.php +++ b/admin_updates.php @@ -98,7 +98,7 @@ if($page == 'overview') $update_information = $ui_text; include_once './install/updates/preconfig.php'; - $preconfig = getPreConfig($new_version); + $preconfig = getPreConfig($current_version); if($preconfig != '') { $update_information .= '
'.$preconfig.$message; diff --git a/install/froxlor.sql b/install/froxlor.sql index ea93c175..6493f521 100644 --- a/install/froxlor.sql +++ b/install/froxlor.sql @@ -451,7 +451,7 @@ INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) V INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (18, 'system', 'vmail_homedir', '/var/customers/mail/'); INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (19, 'system', 'bindconf_directory', '/etc/bind/'); INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (20, 'system', 'bindreload_command', '/etc/init.d/bind9 reload'); -INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (22, 'panel', 'version', '0.9.4-svn1'); +INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (22, 'panel', 'version', '0.9.4-svn2'); INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (23, 'system', 'hostname', 'SERVERNAME'); INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (24, 'login', 'maxloginattempts', '3'); INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (25, 'login', 'deactivatetime', '900'); diff --git a/install/updates/preconfig.php b/install/updates/preconfig.php index 163d22d0..01b87508 100644 --- a/install/updates/preconfig.php +++ b/install/updates/preconfig.php @@ -25,20 +25,13 @@ * * @return string */ -function getPreConfig($version) +function getPreConfig($current_version) { $has_preconfig = false; $return = '

PLEASE NOTE - Important update notifications

'; - if($version == '0.9.4-svn2') - { - $has_preconfig = true; - $return .= 'Froxlor-0.9.4-svn2 now enabled the usage of a domain-wildcard entry and subdomains for this domain at once (subdomains are parsed before the main vhost container). '; - $return .= 'This makes it possible to catch all non-existing subdomains with the main vhost but also have the ability to use subdomains for that domain.
'; - $return .= 'If you would like Froxlor to do so with your domains, the update script can set the correct values for existing domains for you. Note: future domains will have wildcard-entries enabled by default no matter how you decide here.

'; - $return .= 'Do you want to use wildcard-entries for existing domains?: '; - $return .= makeyesno('update_domainwildcardentry', '1', '0', '1'); - } + include_once makeCorrectFile(dirname(__FILE__).'/preconfig/0.9/preconfig_0.9.inc.php'); + parseAndOutputPreconfig($has_preconfig, $return, $current_version); $return .= '

'.makecheckbox('update_changesagreed', 'I have read the update notifications and I am aware of the changes made to my system.', '1', true, '0', true); $return .= '
'; @@ -50,3 +43,17 @@ function getPreConfig($version) return ''; } } + +function versionInUpdate($current_version, $version_to_check) +{ + $pos_a = strpos($current_version, '-svn'); + $pos_b = strpos($current_version, '-svn'); + // if we compare svn-versions, we have to add -svn0 to the version + // to compare it correctly + if($pos_a === false && $pos_b !== false) + { + $current_version.= '-svn0'; + } + + return version_compare($current_version, $version_to_check, '<='); +} diff --git a/install/updates/preconfig/0.9/preconfig_0.9.inc.php b/install/updates/preconfig/0.9/preconfig_0.9.inc.php new file mode 100644 index 00000000..2350cbd2 --- /dev/null +++ b/install/updates/preconfig/0.9/preconfig_0.9.inc.php @@ -0,0 +1,38 @@ + (2010-) + * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt + * @package Language + * @version $Id$ + */ + +/** + * 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 null + */ +function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version) +{ + if(versionInUpdate($current_version, '0.9.4-svn2')) + { + $has_preconfig = true; + $return .= 'Froxlor-0.9.4-svn2 now enabled the usage of a domain-wildcard entry and subdomains for this domain at once (subdomains are parsed before the main vhost container). '; + $return .= 'This makes it possible to catch all non-existing subdomains with the main vhost but also have the ability to use subdomains for that domain.
'; + $return .= 'If you would like Froxlor to do so with your domains, the update script can set the correct values for existing domains for you. Note: future domains will have wildcard-entries enabled by default no matter how you decide here.

'; + $return .= 'Do you want to use wildcard-entries for existing domains?: '; + $return .= makeyesno('update_domainwildcardentry', '1', '0', '1'); + } +} diff --git a/lib/tables.inc.php b/lib/tables.inc.php index fd46432f..b7613590 100644 --- a/lib/tables.inc.php +++ b/lib/tables.inc.php @@ -68,7 +68,7 @@ define('PACKAGE_ENABLED', 2); // VERSION INFO -$version = '0.9.4-svn1'; +$version = '0.9.4-svn2'; $dbversion = '2'; $branding = '';