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:
authorThomas Steur <thomas.steur@googlemail.com>2014-06-27 00:58:42 +0400
committerThomas Steur <thomas.steur@googlemail.com>2014-06-27 00:58:42 +0400
commitf4989de9e725e23675271dad7958a799e6839251 (patch)
tree445a6d8f7a4abd38ba3109ac4b56c7b5d8a61811 /core/Updater.php
parentd2fc5e31085ea699d5593d7078f8bae5787d66ac (diff)
this was a hard one, should make sure the column updater gets called only once and not as often as dimensions are there... makes updater much faster, still does not fix the purge data test
Diffstat (limited to 'core/Updater.php')
-rw-r--r--core/Updater.php19
1 files changed, 9 insertions, 10 deletions
diff --git a/core/Updater.php b/core/Updater.php
index 9e58572900..cd66baf1f0 100644
--- a/core/Updater.php
+++ b/core/Updater.php
@@ -22,6 +22,7 @@ class Updater
public $pathUpdateFilePlugins;
private $componentsToCheck = array();
private $hasMajorDbUpdate = false;
+ private $updatedClasses = array();
/**
* Constructor
@@ -30,6 +31,8 @@ class Updater
{
$this->pathUpdateFileCore = PIWIK_INCLUDE_PATH . '/core/Updates/';
$this->pathUpdateFilePlugins = PIWIK_INCLUDE_PATH . '/plugins/%s/Updates/';
+
+ ColumnUpdates::setUpdater($this);
}
/**
@@ -169,14 +172,18 @@ class Updater
public function update($componentName)
{
$warningMessages = array();
+
foreach ($this->componentsWithUpdateFile[$componentName] as $file => $fileVersion) {
try {
require_once $file; // prefixed by PIWIK_INCLUDE_PATH
$className = $this->getUpdateClassName($componentName, $fileVersion);
- if (class_exists($className, false)) {
+ if (!in_array($className, $this->updatedClasses) && class_exists($className, false)) {
// update()
call_user_func(array($className, 'update'));
+ // makes sure to call Piwik\Columns\Updater only once as one call updates all dimensions at the same
+ // time for better performance
+ $this->updatedClasses[] = $className;
}
self::recordComponentSuccessfullyUpdated($componentName, $fileVersion);
@@ -210,8 +217,6 @@ class Updater
$componentsWithUpdateFile = array();
$hasDimensionUpdate = null;
- ColumnUpdates::setUpdater($this);
-
foreach ($this->componentsWithNewVersion as $name => $versions) {
$currentVersion = $versions[self::INDEX_CURRENT_VERSION];
$newVersion = $versions[self::INDEX_NEW_VERSION];
@@ -219,13 +224,7 @@ class Updater
if ($name == 'core') {
$pathToUpdates = $this->pathUpdateFileCore . '*.php';
} elseif ($this->isDimensionComponent($name)) {
- if (!$hasDimensionUpdate) {
- $hasDimensionUpdate = ColumnUpdates::hasUpdates();
- }
- if ($hasDimensionUpdate) {
- $componentsWithUpdateFile[$name][PIWIK_INCLUDE_PATH . '/core/Columns/Updates.php'] = $newVersion;
- }
- continue;
+ $componentsWithUpdateFile[$name][PIWIK_INCLUDE_PATH . '/core/Columns/Updates.php'] = $newVersion;
} else {
$pathToUpdates = sprintf($this->pathUpdateFilePlugins, $name) . '*.php';
}