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:
authorPeter Zhang <peter@innocraft.com>2022-01-07 15:20:44 +0300
committerGitHub <noreply@github.com>2022-01-07 15:20:44 +0300
commit88797d70be882db2a56cd876fed1063fc1cd929c (patch)
treec24fc5be9313780e04b6323079aaceae4293a10a
parent57cd4a4a8b078a414fb9304eb8bfadd3ff40bef5 (diff)
dependent archive never run (#18403)
* Update ArchiveProcessor.php set plugin not include UserCountry * Update ArchiveProcessor.php update processer * Update ArchiveProcessor.php remove hardcode plugin name * add tests add tests * fix test Co-authored-by: sgiehl <stefan@matomo.org>
-rw-r--r--core/ArchiveProcessor.php5
-rw-r--r--plugins/Goals/tests/System/ProcessDependentArchiveTest.php10
-rw-r--r--tests/PHPUnit/Integration/ArchiveTest.php2
3 files changed, 12 insertions, 5 deletions
diff --git a/core/ArchiveProcessor.php b/core/ArchiveProcessor.php
index 09bfeb2428..2fa72d2dbb 100644
--- a/core/ArchiveProcessor.php
+++ b/core/ArchiveProcessor.php
@@ -679,8 +679,9 @@ class ArchiveProcessor
// vs here we would use
// userId!@%40matomo.org;userId!=hello%40matomo.org;visitorType==new
// thus these would result in different segment hashes and therefore the reports would either show 0 or archive the data twice
- $newSegment = Segment::combine($params->getSegment()->getOriginalString(), SegmentExpression::AND_DELIMITER, $segment);
- if ($newSegment === $segment && $params->getRequestedPlugin() === $plugin) { // being processed now
+ $originSegmentString = $params->getSegment()->getOriginalString();
+ $newSegment = Segment::combine($originSegmentString, SegmentExpression::AND_DELIMITER, $segment);
+ if (!empty($originSegmentString) && $newSegment === $segment && $params->getRequestedPlugin() === $plugin) { // being processed now
return;
}
diff --git a/plugins/Goals/tests/System/ProcessDependentArchiveTest.php b/plugins/Goals/tests/System/ProcessDependentArchiveTest.php
index f700e20b5a..4e131027b7 100644
--- a/plugins/Goals/tests/System/ProcessDependentArchiveTest.php
+++ b/plugins/Goals/tests/System/ProcessDependentArchiveTest.php
@@ -34,6 +34,12 @@ class ProcessDependentArchiveTest extends SystemTestCase
parent::tearDown();
}
+ public function test_numArchivesCreated_day()
+ {
+ API::getInstance()->getMetrics(self::$fixture->idSite, 'day', '2009-01-04');
+ $this->assertNumRangeArchives(5, 1); // days;
+ }
+
public function test_numArchivesCreated()
{
API::getInstance()->get(self::$fixture->idSite, 'range', $this->requestRange);
@@ -46,9 +52,9 @@ class ProcessDependentArchiveTest extends SystemTestCase
$this->assertNumRangeArchives(6);
}
- private function assertNumRangeArchives($expectedArchives)
+ private function assertNumRangeArchives($expectedArchives,$period = 5)
{
- $archives = Db::fetchAll('SELECT `name` from ' . Common::prefixTable($this->archiveTable) . ' WHERE period = 5 and `name` like "done%"');
+ $archives = Db::fetchAll('SELECT `name` from ' . Common::prefixTable($this->archiveTable) . ' WHERE period = '.$period.' and `name` like "done%"');
$numArchives = count($archives);
$message = sprintf('Expected archives: %s, got: %s. These were the archives %s', $expectedArchives, $numArchives, json_encode($archives));
$this->assertEquals($expectedArchives, $numArchives, $message);
diff --git a/tests/PHPUnit/Integration/ArchiveTest.php b/tests/PHPUnit/Integration/ArchiveTest.php
index 820dfe019c..2ca52744de 100644
--- a/tests/PHPUnit/Integration/ArchiveTest.php
+++ b/tests/PHPUnit/Integration/ArchiveTest.php
@@ -237,7 +237,7 @@ class ArchiveTest extends IntegrationTestCase
$expected = [
['idarchive' => '2', 'date1' => '2020-03-04', 'date2' => '2020-03-04', 'name' => 'done', 'value' => '1'],
['idarchive' => '13', 'date1' => '2020-03-05', 'date2' => '2020-03-05', 'name' => 'done', 'value' => '1'],
- ['idarchive' => '16', 'date1' => '2020-03-04', 'date2' => '2020-03-05', 'name' => 'done.VisitsSummary', 'value' => '1'],
+ ['idarchive' => '18', 'date1' => '2020-03-04', 'date2' => '2020-03-05', 'name' => 'done.VisitsSummary', 'value' => '1'],
];
$this->assertEquals($expected, $archives);
}