diff options
-rw-r--r-- | core/FrontController.php | 23 | ||||
-rw-r--r-- | core/Updater.php | 21 |
2 files changed, 21 insertions, 23 deletions
diff --git a/core/FrontController.php b/core/FrontController.php index 242ba03df6..f9dd3259cb 100644 --- a/core/FrontController.php +++ b/core/FrontController.php @@ -14,6 +14,7 @@ use Piwik\API\Request; use Piwik\API\ResponseBuilder; use Piwik\Container\StaticContainer; use Piwik\Exception\AuthenticationFailedException; +use Piwik\Exception\DatabaseSchemaIsNewerThanCodebaseException; use Piwik\Http\ControllerResolver; use Piwik\Http\Router; use Piwik\Plugin\Report; @@ -318,8 +319,7 @@ class FrontController extends Singleton */ Piwik::postEvent('Request.dispatchCoreAndPluginUpdatesScreen'); - $updater = new Updater(); - $updater->throwIfPiwikVersionIsOlderThanDBSchema(); // TODO: really should have a method like this + $this->throwIfPiwikVersionIsOlderThanDBSchema(); \Piwik\Plugin\Manager::getInstance()->installLoadedPlugins(); @@ -557,4 +557,23 @@ class FrontController extends Singleton return $result; } + /** + * This method ensures that Piwik Platform cannot be running when using a NEWER database. + */ + private function throwIfPiwikVersionIsOlderThanDBSchema() + { + $updater = new Updater(); + + $dbSchemaVersion = $updater->getCurrentComponentVersion('core'); + $current = Version::VERSION; + if (-1 === version_compare($current, $dbSchemaVersion)) { + $messages = array( + Piwik::translate('General_ExceptionDatabaseVersionNewerThanCodebase', array($current, $dbSchemaVersion)), + Piwik::translate('General_ExceptionDatabaseVersionNewerThanCodebaseWait'), + // we cannot fill in the Super User emails as we are failing before Authentication was ready + Piwik::translate('General_ExceptionContactSupportGeneric', array('', '')) + ); + throw new DatabaseSchemaIsNewerThanCodebaseException(implode(" ", $messages)); + } + } } diff --git a/core/Updater.php b/core/Updater.php index a98ef24f73..dad7116177 100644 --- a/core/Updater.php +++ b/core/Updater.php @@ -116,27 +116,6 @@ class Updater } /** - * This method ensures that Piwik Platform cannot be running when using a NEWER database. - * - * TODO: can I move this to FrontController & deprecate this? - */ - public function throwIfPiwikVersionIsOlderThanDBSchema() - { - $dbSchemaVersion = $this->getCurrentComponentVersion('core'); - $current = Version::VERSION; - if(-1 === version_compare($current, $dbSchemaVersion)) { - $messages = array( - Piwik::translate('General_ExceptionDatabaseVersionNewerThanCodebase', array($current, $dbSchemaVersion)), - Piwik::translate('General_ExceptionDatabaseVersionNewerThanCodebaseWait'), - // we cannot fill in the Super User emails as we are failing before Authentication was ready - Piwik::translate('General_ExceptionContactSupportGeneric', array('', '')) - ); - throw new DatabaseSchemaIsNewerThanCodebaseException(implode(" ", $messages)); - } - } - - - /** * Returns a list of components (core | plugin) that need to run through the upgrade process. * * @param string[] $componentsToCheck An array mapping component names to the latest locally available version. |