Skip to content

Commit

Permalink
* Fixed error on upgrade handling.
Browse files Browse the repository at this point in the history
  • Loading branch information
nuxsmin committed Aug 11, 2014
1 parent d072996 commit 07dfdba
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 19 deletions.
38 changes: 20 additions & 18 deletions inc/init.php
Original file line number Diff line number Diff line change
Expand Up @@ -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:') . ' <a href="index.php?upgrade=1&a=upgrade">' . _('Actualizar') . '</a>');
}
self::initError(_('La aplicación necesita actualizarse'), _('Si es un administrador pulse en el enlace:') . ' <a href="index.php?upgrade=1&a=upgrade">' . _('Actualizar') . '</a>');
}

$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();
}
}

Expand Down
2 changes: 1 addition & 1 deletion inc/util.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 07dfdba

Please sign in to comment.