From d2fc5e31085ea699d5593d7078f8bae5787d66ac Mon Sep 17 00:00:00 2001 From: Thomas Steur Date: Thu, 26 Jun 2014 02:16:38 +0200 Subject: smarter install and update of columns which will automatically update the column in case the type changes making it super easy for developers, not sure if everything works already and need to xhprof it --- core/Updater.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'core/Updater.php') diff --git a/core/Updater.php b/core/Updater.php index d0b2fd9ad3..9e58572900 100644 --- a/core/Updater.php +++ b/core/Updater.php @@ -210,6 +210,8 @@ class Updater $componentsWithUpdateFile = array(); $hasDimensionUpdate = null; + ColumnUpdates::setUpdater($this); + foreach ($this->componentsWithNewVersion as $name => $versions) { $currentVersion = $versions[self::INDEX_CURRENT_VERSION]; $newVersion = $versions[self::INDEX_NEW_VERSION]; @@ -217,7 +219,7 @@ class Updater if ($name == 'core') { $pathToUpdates = $this->pathUpdateFileCore . '*.php'; } elseif ($this->isDimensionComponent($name)) { - if (is_null($hasDimensionUpdate)) { + if (!$hasDimensionUpdate) { $hasDimensionUpdate = ColumnUpdates::hasUpdates(); } if ($hasDimensionUpdate) { @@ -295,10 +297,14 @@ class Updater self::recordComponentSuccessfullyUpdated($name, $currentVersion); } - // 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) { + if ($this->isDimensionComponent($name)) { + $isComponentOutdated = $currentVersion !== $version; + } else { + // note: when versionCompare == 1, the version in the DB is newer, we choose to ignore + $isComponentOutdated = version_compare($currentVersion, $version) == -1; + } + + if ($isComponentOutdated || $currentVersion === false) { $componentsToUpdate[$name] = array( self::INDEX_CURRENT_VERSION => $currentVersion, self::INDEX_NEW_VERSION => $version -- cgit v1.2.3