diff options
author | diosmosis <benaka@piwik.pro> | 2015-02-26 01:48:15 +0300 |
---|---|---|
committer | diosmosis <benaka@piwik.pro> | 2015-02-26 01:48:15 +0300 |
commit | 5a830fbc1ba686feaa6e6437ab3fc4666a11fed5 (patch) | |
tree | ea1da4f0cedfbd407f08f63a6e5471371c1eff97 /core | |
parent | 9ac8e1d722d348a17b1a279725be1dc185d852b6 (diff) |
Refs #7276, add integration test for core:update command, fix strict notice errors caused by change to Updates.php and add some more functionality to ConsoleCommandTestCase base class.
Diffstat (limited to 'core')
-rw-r--r-- | core/Columns/Updater.php | 6 | ||||
-rw-r--r-- | core/Updater.php | 4 | ||||
-rw-r--r-- | core/Updates.php | 22 |
3 files changed, 24 insertions, 8 deletions
diff --git a/core/Columns/Updater.php b/core/Columns/Updater.php index 7161bda84c..3de83592e8 100644 --- a/core/Columns/Updater.php +++ b/core/Columns/Updater.php @@ -33,7 +33,7 @@ class Updater extends \Piwik\Updates * // and user will have to manually run the query * ) */ - public static function getSql(PiwikUpdater $updater) + public static function getMigrationQueries(PiwikUpdater $updater) { $sqls = array(); @@ -53,9 +53,9 @@ class Updater extends \Piwik\Updates /** * Incremental version update */ - public static function update(PiwikUpdater $updater) + public static function doUpdate(PiwikUpdater $updater) { - foreach (self::getSql($updater) as $sql => $errorCode) { + foreach (self::getMigrationQueries($updater) as $sql => $errorCode) { try { Db::exec($sql); } catch (\Exception $e) { diff --git a/core/Updater.php b/core/Updater.php index d1cac3c3f4..7f19a03ae3 100644 --- a/core/Updater.php +++ b/core/Updater.php @@ -200,7 +200,7 @@ class Updater $classNames[] = $className; - $queriesForComponent = call_user_func(array($className, 'getSql'), $this); + $queriesForComponent = call_user_func(array($className, 'getMigrationQueries'), $this); foreach ($queriesForComponent as $query => $error) { $queries[] = $query . ';'; } @@ -249,7 +249,7 @@ class Updater ) { $this->executeListenerHook('onComponentUpdateFileStarting', $componentName, $file, $className, $fileVersion); - call_user_func(array($className, 'update'), $this); + call_user_func(array($className, 'doUpdate'), $this); $this->executeListenerHook('onComponentUpdateFileFinished', $componentName, $file, $className, $fileVersion); diff --git a/core/Updates.php b/core/Updates.php index 36f538cddc..206056ab63 100644 --- a/core/Updates.php +++ b/core/Updates.php @@ -16,6 +16,21 @@ namespace Piwik; abstract class Updates { /** + * @deprecated since v2.12.0 + */ + static function getSql() + { + return array(); + } + + /** + * @deprecated since v2.12.0 + */ + static function update() + { + } + + /** * Return SQL to be executed in this update * * @return array( @@ -24,16 +39,17 @@ abstract class Updates * // and user will have to manually run the query * ) */ - static function getSql(Updater $updater) + public static function getMigrationQueries(Updater $updater) { - return array(); + return static::getSql(); } /** * Incremental version update */ - static function update(Updater $updater) + public static function doUpdate(Updater $updater) { + static::update(); } /** |