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:
Diffstat (limited to 'core/Updater.php')
-rw-r--r--core/Updater.php21
1 files changed, 21 insertions, 0 deletions
diff --git a/core/Updater.php b/core/Updater.php
index 692034d5e9..c9872d3481 100644
--- a/core/Updater.php
+++ b/core/Updater.php
@@ -8,6 +8,7 @@
*/
namespace Piwik;
use Piwik\Columns\Updater as ColumnUpdater;
+use Piwik\Exception\DatabaseSchemaIsNewerThanCodebaseException;
/**
* Load and execute all relevant, incremental update scripts for Piwik core and plugins, and bump the component version numbers for completed updates.
@@ -95,6 +96,26 @@ class Updater
return 'version_' . $name;
}
+
+ /**
+ * This method ensures that Piwik Platform cannot be running when using a NEWER database
+ */
+ public static function throwIfPiwikVersionIsOlderThanDBSchema()
+ {
+ $dbSchemaVersion = self::getCurrentRecordedComponentVersion('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.
*