From 07dfdba406e221d77b2bded748e95b6b9f207ca7 Mon Sep 17 00:00:00 2001 From: nuxsmin Date: Mon, 11 Aug 2014 03:29:45 +0200 Subject: [PATCH] * Fixed error on upgrade handling. --- inc/init.php | 38 ++++++++++++++++++++------------------ inc/util.class.php | 2 +- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/inc/init.php b/inc/init.php index d8668f7f0..a2cbe9bb1 100644 --- a/inc/init.php +++ b/inc/init.php @@ -416,28 +416,30 @@ private static function checkVersion() if ($databaseVersion < $appVersion && SP_Common::parseParams('g', 'nodbupgrade', 0) === 0 ) { - if (SP_Upgrade::needDBUpgrade($appVersion) && !self::checkMaintenanceMode(true)) { - if (SP_Config::getValue('upgrade_key', 0) === 0) { - SP_Config::setValue('upgrade_key', sha1(uniqid(mt_rand(), true))); - SP_Config::setValue('maintenance', true); - } + if (SP_Upgrade::needDBUpgrade($appVersion)){ + if(!self::checkMaintenanceMode(true)) { + if (SP_Config::getValue('upgrade_key', 0) === 0) { + SP_Config::setValue('upgrade_key', sha1(uniqid(mt_rand(), true))); + SP_Config::setValue('maintenance', true); + } - self::initError(_('La aplicaciĆ³n necesita actualizarse'), _('Si es un administrador pulse en el enlace:') . ' ' . _('Actualizar') . ''); - } + self::initError(_('La aplicaciĆ³n necesita actualizarse'), _('Si es un administrador pulse en el enlace:') . ' ' . _('Actualizar') . ''); + } - $action = SP_Common::parseParams('g', 'a'); - $hash = SP_Common::parseParams('g', 'h'); + $action = SP_Common::parseParams('g', 'a'); + $hash = SP_Common::parseParams('g', 'h'); - if ($action === 'upgrade' && $hash === SP_Config::getValue('upgrade_key', 0)) { - if (SP_Upgrade::doUpgrade($databaseVersion)) { - SP_Config::setConfigValue('version', $appVersion); - SP_Config::setValue('maintenance', false); - SP_Config::deleteKey('upgrade_key'); - $update = true; + if ($action === 'upgrade' && $hash === SP_Config::getValue('upgrade_key', 0)) { + if (SP_Upgrade::doUpgrade($databaseVersion)) { + SP_Config::setConfigValue('version', $appVersion); + SP_Config::setValue('maintenance', false); + SP_Config::deleteKey('upgrade_key'); + $update = true; + } + } else { + SP_Html::render('upgrade'); + exit(); } - } else { - SP_Html::render('upgrade'); - exit(); } } diff --git a/inc/util.class.php b/inc/util.class.php index 9db5a85aa..7137be69a 100644 --- a/inc/util.class.php +++ b/inc/util.class.php @@ -264,7 +264,7 @@ public static function curlIsAvailable() */ public static function getVersion($retBuild = false) { - $build = 14; + $build = 15; $version = array(1, 1, 2); if ($retBuild) {