Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordiosmosis <benaka@piwik.pro>2015-03-10 16:14:32 +0300
committerdiosmosis <benaka@piwik.pro>2015-03-10 16:14:32 +0300
commit6e483868d4bc62719dad5b2ed44f870e18dfd72e (patch)
tree96eb0f78ce8227f287d0baa14fbb83588585312b
parentc54b3b7738f9e8113b3c0d86229420b076bc8494 (diff)
Move throwIfPiwikVersionIsOlderThanDBSchema that is only used in FrontController to FrontController.
-rw-r--r--core/FrontController.php23
-rw-r--r--core/Updater.php21
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.