fixes #191, auto reset $_SESSION['need_update'] on new version

To avoid saying the user a new version is available after a manual upgrade
(which didn't reset the $_SESSION['need_update'] variable)
This commit is contained in:
plegall
2017-03-30 11:41:01 +02:00
parent 0a85001ae8
commit d50aa7476c
2 changed files with 4 additions and 5 deletions
+2 -3
View File
@@ -56,14 +56,14 @@ class updates
static function check_piwigo_upgrade()
{
$_SESSION['need_update'] = null;
$_SESSION['need_update'.PHPWG_VERSION] = null;
if (preg_match('/(\d+\.\d+)\.(\d+)/', PHPWG_VERSION, $matches)
and @fetchRemote(PHPWG_URL.'/download/all_versions.php?rand='.md5(uniqid(rand(), true)), $result))
{
$all_versions = @explode("\n", $result);
$new_version = trim($all_versions[0]);
$_SESSION['need_update'] = version_compare(PHPWG_VERSION, $new_version, '<');
$_SESSION['need_update'.PHPWG_VERSION] = version_compare(PHPWG_VERSION, $new_version, '<');
}
}
@@ -610,7 +610,6 @@ class updates
deltree(PHPWG_ROOT_PATH.$conf['data_location'].'update');
invalidate_user_cache(true);
$template->delete_compiled_templates();
unset($_SESSION['need_update']);
if ($step == 2)
{
$page['infos'][] = l10n('Update Complete');