From f27c691bfd692e88a7e02d3170c58c6b7f01ea24 Mon Sep 17 00:00:00 2001 From: mattab Date: Fri, 9 May 2014 12:38:24 +1200 Subject: Fixes #5115 Fixes couple issues in the logic which should finally solve reported issues. --- core/Updater.php | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'core/Updater.php') diff --git a/core/Updater.php b/core/Updater.php index a1f39fb71b..d579fd28f1 100644 --- a/core/Updater.php +++ b/core/Updater.php @@ -252,26 +252,21 @@ class Updater throw $e; } } - if ($currentVersion === false) { - if ($name === 'core') { - // This should not happen - $currentVersion = Version::VERSION; - } else { - // When plugins have been installed since Piwik 2.0 this should not happen - // We "fix" the data for any plugin that may have been ported from Piwik 1.x - $currentVersion = $version; - } + + if ($name === 'core' && $currentVersion === false) { + // This should not happen + $currentVersion = Version::VERSION; self::recordComponentSuccessfullyUpdated($name, $currentVersion); } - $versionCompare = version_compare($currentVersion, $version); - if ($versionCompare == -1) { + // note: when versionCompare == 1, the version in the DB is newer, we choose to ignore + $currentVersionIsOutdated = version_compare($currentVersion, $version) == -1; + $isComponentOutdated = $currentVersion === false || $currentVersionIsOutdated; + if ($isComponentOutdated) { $componentsToUpdate[$name] = array( self::INDEX_CURRENT_VERSION => $currentVersion, self::INDEX_NEW_VERSION => $version ); - } else if ($versionCompare == 1) { - // the version in the DB is newest.. we choose to ignore } } return $componentsToUpdate; -- cgit v1.2.3