diff options
Diffstat (limited to 'core/FrontController.php')
-rw-r--r-- | core/FrontController.php | 23 |
1 files changed, 21 insertions, 2 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)); + } + } } |