- fix update from syscp-trunk (current rev 2739), fixes #27

This commit is contained in:
Michael Kaufmann (d00p)
2010-02-23 13:24:56 +00:00
parent dd9b72e45e
commit fea80269ed
2 changed files with 28 additions and 12 deletions

View File

@@ -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") . "\";");
}
}
?>

View File

@@ -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,