From fea80269ed128fa2ba61499f97094a1feda8a993 Mon Sep 17 00:00:00 2001 From: "Michael Kaufmann (d00p)" Date: Tue, 23 Feb 2010 13:24:56 +0000 Subject: [PATCH] - fix update from syscp-trunk (current rev 2739), fixes #27 --- admin_updates.php | 34 ++++++++++++++----- .../updates/froxlor/0.9/update_0.9.inc.php | 6 ++-- 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/admin_updates.php b/admin_updates.php index d3e18240..5b954d76 100644 --- a/admin_updates.php +++ b/admin_updates.php @@ -21,20 +21,36 @@ require ("./lib/init.php"); if($page == 'overview') { $log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_updates"); - + + /** + * this is a dirty hack but syscp 1.4.2.1 does not + * has any version/dbversion in the database (don't know why) + * so we have to set them both to run a correct upgrade + */ + if (!isset($settings['panel']['version']) + || $settings['panel']['version'] == '' + ) { + $settings['panel']['version'] = '1.4.2.1'; + } + if (!isset($settings['system']['dbversion']) + || $settings['system']['dbversion'] == '' + ) { + $settings['system']['dbversion'] = 2; + } + if(hasUpdates($version)) { if(isset($_POST['send']) && $_POST['send'] == 'send') { - + eval("echo \"" . getTemplate("update/update_start") . "\";"); - + include_once('./install/updatesql.php'); - + $redirect_url = 'admin_index.php'; eval("echo \"" . getTemplate("update/update_end") . "\";"); - + updateCounters(); inserttask('1'); @chmod('./lib/userdata.inc.php', 0440); @@ -43,19 +59,19 @@ if($page == 'overview') { $current_version = $settings['panel']['version']; $new_version = $version; - + $ui_text = $lng['update']['update_information']; $ui_text = str_replace('%curversion', $current_version, $ui_text); $ui_text = str_replace('%newversion', $new_version, $ui_text); $update_information = $ui_text; - + eval("echo \"" . getTemplate("update/index") . "\";"); } } else { /* - * @TODO version-webcheck check here + * @TODO version-webcheck check here */ $success_message = $lng['update']['noupdatesavail']; @@ -63,5 +79,5 @@ if($page == 'overview') eval("echo \"" . getTemplate("update/noupdatesavail") . "\";"); } } - + ?> diff --git a/install/updates/froxlor/0.9/update_0.9.inc.php b/install/updates/froxlor/0.9/update_0.9.inc.php index aa6b78fb..7c78303b 100644 --- a/install/updates/froxlor/0.9/update_0.9.inc.php +++ b/install/updates/froxlor/0.9/update_0.9.inc.php @@ -20,13 +20,13 @@ if(isFroxlorVersion('0.9-r0')) showUpdateStep("Updating from 0.9-r0 to 0.9-r1", false); showUpdateStep("Performing database updates"); /* - * add missing database-updates if necessary (old: update/update_database.php + * add missing database-updates if necessary (old: update/update_database.php) */ - if(!isset($settings['system']['dbversion']) || $settings['system']['dbversion'] < '1') + if(isset($settings['system']['dbversion']) && (int)$settings['system']['dbversion'] < 1) { $db->query("ALTER TABLE `panel_databases` ADD `dbserver` INT( 11 ) UNSIGNED NOT NULL default '0';"); } - if(!isset($settings['system']['dbversion']) || $settings['system']['dbversion'] < '2') + if(isset($settings['system']['dbversion']) && (int)$settings['system']['dbversion'] < 2) { $db->query("ALTER TABLE `panel_ipsandports` CHANGE `ssl_cert` `ssl_cert_file` VARCHAR( 255 ) NOT NULL, ADD `ssl_key_file` VARCHAR( 255 ) NOT NULL,