diff options
author | diosmosis <benaka@piwik.pro> | 2015-03-10 16:11:20 +0300 |
---|---|---|
committer | diosmosis <benaka@piwik.pro> | 2015-03-10 16:11:20 +0300 |
commit | c54b3b7738f9e8113b3c0d86229420b076bc8494 (patch) | |
tree | b172cbba20c946c6673ccd832e20eccad98b66fe /core/Updater.php | |
parent | 79f9b8b98368539839741ae5d7bd68733de3468e (diff) |
More refactoring to Updates.php base & Columns\Updater, make Updates.php methods instance methods, create Update instances via DI, make Columns\Updater use instance methods instead of static, and add integration test for Columns\Updater.
Diffstat (limited to 'core/Updater.php')
-rw-r--r-- | core/Updater.php | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/core/Updater.php b/core/Updater.php index 3f90e2edd2..a98ef24f73 100644 --- a/core/Updater.php +++ b/core/Updater.php @@ -9,6 +9,7 @@ namespace Piwik; use Piwik\Columns\Updater as ColumnUpdater; +use Piwik\Container\StaticContainer; use Piwik\Exception\DatabaseSchemaIsNewerThanCodebaseException; use Piwik\Updater\UpdateObserver; @@ -200,7 +201,8 @@ class Updater $classNames[] = $className; - $queriesForComponent = call_user_func(array($className, 'getMigrationQueries'), $this); + $update = StaticContainer::getContainer()->make($className); + $queriesForComponent = call_user_func(array($update, 'getMigrationQueries'), $this); foreach ($queriesForComponent as $query => $error) { $queries[] = $query . ';'; } @@ -249,7 +251,8 @@ class Updater ) { $this->executeListenerHook('onComponentUpdateFileStarting', array($componentName, $file, $className, $fileVersion)); - call_user_func(array($className, 'doUpdate'), $this); + $update = StaticContainer::getContainer()->make($className); + call_user_func(array($update, 'doUpdate'), $this); $this->executeListenerHook('onComponentUpdateFileFinished', array($componentName, $file, $className, $fileVersion)); @@ -589,8 +592,6 @@ class Updater * * @param string $name * @param string $version - * - * TODO: only non-Updater pllace this is used is when installing plugins. create a Plugin\Installer class that derives from Updater for plugin installation */ public static function recordComponentSuccessfullyUpdated($name, $version) { |