diff options
-rw-r--r-- | core/Updater.php | 24 | ||||
-rw-r--r-- | tests/PHPUnit/Integration/UrlNormalizationTest.php | 15 |
2 files changed, 20 insertions, 19 deletions
diff --git a/core/Updater.php b/core/Updater.php index b993c9b46a..dfda38878a 100644 --- a/core/Updater.php +++ b/core/Updater.php @@ -28,8 +28,8 @@ class Piwik_Updater public $pathUpdateFileCore; public $pathUpdateFilePlugins; - private $componentsToCheck = array(); + private $hasMajorDbUpdate = false; public function __construct() { @@ -99,29 +99,13 @@ class Piwik_Updater /** * Does one of the new versions involve a major database update? + * Note: getSqlQueriesToExecute() must be called before this method! * * @return bool */ public function hasMajorDbUpdate() { - foreach($this->componentsWithUpdateFile as $componentName => $componentUpdateInfo) - { - foreach($componentUpdateInfo as $file => $fileVersion) - { - require_once $file; - - $className = $this->getUpdateClassName($componentName, $fileVersion); - if(class_exists($className, false)) - { - $isMajor = call_user_func( array($className, 'isMajorUpdate')); - if ($isMajor) { - return true; - } - } - } - } - - return false; + return $this->hasMajorDbUpdate; } /** @@ -145,6 +129,8 @@ class Piwik_Updater foreach($queriesForComponent as $query => $error) { $queries[] = $query.';'; } + + $this->hasMajorDbUpdate = $this->hasMajorDbUpdate || call_user_func( array($className, 'isMajorUpdate')); } } // unfortunately had to extract this query from the Piwik_Option class diff --git a/tests/PHPUnit/Integration/UrlNormalizationTest.php b/tests/PHPUnit/Integration/UrlNormalizationTest.php index d0456279f6..38f48e31b6 100644 --- a/tests/PHPUnit/Integration/UrlNormalizationTest.php +++ b/tests/PHPUnit/Integration/UrlNormalizationTest.php @@ -42,12 +42,27 @@ class Test_Piwik_Integration_UrlNormalization extends IntegrationTestCase 'idSite' => self::$idSite, 'date' => self::$dateTime, )); + $return[] = array('Actions.getPageUrls', array( 'testSuffix' => '_pagesSegmented', 'idSite' => self::$idSite, 'date' => self::$dateTime, 'segment' => 'pageUrl==https://WWw.example.org/foo/bar2.html', )); + // Testing entryPageUrl with AND segment + $return[] = array('Actions.getPageUrls', array( + 'testSuffix' => '_pagesSegmented', + 'idSite' => self::$idSite, + 'date' => self::$dateTime, + 'segment' => 'entryPageUrl==http://example.org/foo/bar.html;pageUrl==https://WWw.example.org/foo/bar2.html', + )); + // Testing exitPageUrl with AND segment + $return[] = array('Actions.getPageUrls', array( + 'testSuffix' => '_pagesSegmented', + 'idSite' => self::$idSite, + 'date' => self::$dateTime, + 'segment' => 'exitPageUrl==example.org/foo/bar4.html;pageUrl==https://WWw.example.org/foo/bar2.html', + )); $return[] = array('Actions.getPageUrls', array( 'testSuffix' => '_pagesSegmented', 'idSite' => self::$idSite, |