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:
authordizzy <diosmosis@users.noreply.github.com>2021-04-12 06:23:28 +0300
committerGitHub <noreply@github.com>2021-04-12 06:23:28 +0300
commit5573d22a459d65749ebdfc257ac773979ae12ea4 (patch)
treed3eac59ac3228b0e31848ab170bea793c43b03a5 /plugins/CoreConsole
parent375af64031844e6161d8ce6e778da304e0680230 (diff)
Initiate range archiving if an archive is invalidated, the request is from the browser, and browser archiving is authorized (#17379)
* Initiate archiving if an archive is invalidated, the request is from the browser, and browser archiving for the current request is authorized. * add test that was strangely removed and add tests for period = range * Add test for tracking data in the past and fix invalidation issue in core:archive. * Add test for default use case of core:archive w/ browser initiated range archiving. * actually just dont perform the check if the period does not include today * undo isPeriodIncludesToday change * Fix ArchiveInvalidationTest and get to work, fix bug in Loader causing it to fail * fix tests * add comment to test * Fix CronArchiveTest, make sure we do not use a TTL when running invalidateRecentDate("yesterday"). * tweak comment * make sure invalid ranges only rearchive when authorized to rearchive child archive or when all child archives are usable while still respecting ttl for periods that include today * instead of previous change, make range ttl get respected if range period is used and archiving is enabled for the current request/period * remove dead code + tweak test * add check for invalidated archive * move new invalidation check to Loader from ArchiveSelector since getArchiveIdAndVisits is used in multiple code paths now * remove TODO * remove use * apply pr feedback * get tests to pass * Fix strange test failure on travis-ci (class was loaded before mock file methods used in next test were loaded)
Diffstat (limited to 'plugins/CoreConsole')
-rw-r--r--plugins/CoreConsole/tests/System/ArchiveCronTest.php87
-rw-r--r--plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__Goals.get_month.xml14
-rw-r--r--plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__VisitFrequency.get_month.xml10
-rw-r--r--plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__VisitsSummary.get_day.xml10
-rw-r--r--plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__VisitsSummary.get_month.xml10
-rw-r--r--plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__VisitsSummary.get_week.xml12
-rw-r--r--plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__VisitsSummary.get_year.xml12
-rw-r--r--plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive__Actions.get_range.xml4
-rw-r--r--plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive__DevicesDetection.getType_range.xml20
-rw-r--r--plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive__VisitsSummary.get_range.xml10
-rw-r--r--plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive_before_invalidate__Actions.get_range.xml11
-rw-r--r--plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive_before_invalidate__DevicesDetection.getType_range.xml140
-rw-r--r--plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive_before_invalidate__VisitsSummary.get_range.xml12
-rw-r--r--plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive_rearchived__Actions.get_range.xml11
-rw-r--r--plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive_rearchived__DevicesDetection.getType_range.xml140
-rw-r--r--plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive_rearchived__VisitsSummary.get_range.xml12
16 files changed, 464 insertions, 51 deletions
diff --git a/plugins/CoreConsole/tests/System/ArchiveCronTest.php b/plugins/CoreConsole/tests/System/ArchiveCronTest.php
index cd9acd7db3..1872a55157 100644
--- a/plugins/CoreConsole/tests/System/ArchiveCronTest.php
+++ b/plugins/CoreConsole/tests/System/ArchiveCronTest.php
@@ -7,7 +7,11 @@
*/
namespace Piwik\Plugins\CoreConsole\tests\System;
+use Piwik\Archive\ArchivePurger;
+use Piwik\ArchiveProcessor\Rules;
use Piwik\CronArchive;
+use Piwik\DataAccess\ArchiveWriter;
+use Piwik\DataAccess\Model;
use Piwik\Http;
use Piwik\Plugins\SegmentEditor\API;
use Piwik\Site;
@@ -58,6 +62,21 @@ class ArchiveCronTest extends SystemTestCase
Site::clearCache();
}
+ private static function trackVisitInPast($ip = null)
+ {
+ $t = Fixture::getTracker(self::$fixture->idSite, '2012-08-09 16:00:00');
+ if ($ip) {
+ $t->setIp($ip);
+ }
+ $t->setUserAgent('Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148');
+ $t->setUrl('http://pastwebsite.com/here/we/go');
+ Fixture::checkResponse($t->doTrackPageView('a page title'));
+
+ // update ts_archived for archives in 2012_08 so they will be invalidated and rearchived
+ $sql = "UPDATE " . ArchiveTableCreator::getNumericTable(Date::factory('2012-08-01')) . " SET ts_archived = ?";
+ Db::query($sql, [Date::now()->subHour(2)->getDatetime()]);
+ }
+
private static function addNewSegmentToPast()
{
Config::getInstance()->General['enable_browser_archiving_triggering'] = 0;
@@ -218,6 +237,7 @@ class ArchiveCronTest extends SystemTestCase
self::forceCurlCliMulti();
self::addNewSegmentToPast();
self::trackVisitsForToday();
+ self::trackVisitInPast(); // track in the past so we end up invalidating and rearchiving a past month
$output = $this->runArchivePhpCron();
} finally {
self::undoForceCurlCliMulti();
@@ -288,6 +308,9 @@ class ArchiveCronTest extends SystemTestCase
$this->assertEquals([5, 1], array_values($archiveValues));
}
+ /**
+ * @depends testArchivePhpCronWithSingleReportRearchive
+ */
public function testArchivePhpCronArchivesFullRanges()
{
self::$fixture->getTestEnvironment()->overrideConfig('General', 'enable_browser_archiving_triggering', 0);
@@ -319,6 +342,70 @@ class ArchiveCronTest extends SystemTestCase
);
}
+ /**
+ * @depends testArchivePhpCronArchivesFullRanges
+ */
+ public function testRangeBrowserArchivingWorksWhenInvalidatedByVisit()
+ {
+ self::$fixture->getTestEnvironment()->overrideConfig('General', 'enable_browser_archiving_triggering', 0);
+ // remove the value, since the default is to always force archiving on browser request
+ self::$fixture->getTestEnvironment()->removeOverriddenConfig('General', 'archiving_range_force_on_browser_request');
+ self::$fixture->getTestEnvironment()->save();
+
+ Config::getInstance()->General['enable_browser_archiving_triggering'] = 0;
+ unset(Config::getInstance()->General['archiving_range_force_on_browser_request']);
+
+ $table = ArchiveTableCreator::getNumericTable(Date::factory('2012-08-09'));
+ $blobTable = ArchiveTableCreator::getBlobTable(Date::factory('2012-08-09'));
+
+ // remove existing range archives
+ $idArchives = Db::fetchAll("SELECT DISTINCT idarchive FROM $table WHERE period = 5");
+ $idArchives = array_column($idArchives, 'idarchive');
+
+ $model = new Model();
+ $model->deleteArchiveIds($table, $blobTable, $idArchives);
+
+ // process archives once
+ $this->runApiTests(array(
+ 'VisitsSummary.get', 'Actions.get', 'DevicesDetection.getType'),
+ array('idSite' => '1',
+ 'date' => '2012-08-09,2012-08-13',
+ 'periods' => array('range'),
+ 'testSuffix' => '_range_archive_before_invalidate')
+ );
+
+ $this->trackVisitInPast($ip = '124.56.23.23');
+
+ $cronArchive = new CronArchive();
+ $cronArchive->init();
+ $cronArchive->invalidateArchivedReportsForSitesThatNeedToBeArchivedAgain(1);
+
+ // process day archive so range archive will process below (if we don't, then we'll skip processing the range archive,
+ // since it wouldn't trigger the child day archive. then later the day archive would be updated, and not the range, resulting
+ // in inaccurate data)
+ Rules::setBrowserTriggerArchiving(true);
+ \Piwik\Plugins\VisitsSummary\API::getInstance()->get(1, 'day', '2012-08-09');
+ Rules::setBrowserTriggerArchiving(false);
+
+ $rangeArchivesInvalid = Db::fetchAll("SELECT idarchive, name, date1, date2 FROM " . $table . " WHERE period = 5 and name LIKE 'done.%' and value = " . ArchiveWriter::DONE_INVALIDATED);
+ $this->assertNotEmpty($rangeArchivesInvalid);
+
+ // cron archive not run, but ranges should still be rearchived
+ $this->runApiTests(array(
+ 'VisitsSummary.get', 'Actions.get', 'DevicesDetection.getType'),
+ array('idSite' => '1',
+ 'date' => '2012-08-09,2012-08-13',
+ 'periods' => array('range'),
+ 'testSuffix' => '_range_archive_rearchived')
+ );
+
+ $archivePurger = StaticContainer::get(ArchivePurger::class);
+ $archivePurger->purgeInvalidatedArchivesFrom(Date::factory('2020-08-09'));
+
+ $rangeArchivesStillInvalid = Db::fetchAll("SELECT idarchive, name, date1, date2 FROM " . $table . " WHERE period = 5 and name = 'done.%' and value = " . ArchiveWriter::DONE_INVALIDATED);
+ $this->assertEmpty($rangeArchivesStillInvalid);
+ }
+
public function test_archivePhpScript_DoesNotFail_WhenCommandHelpRequested()
{
$output = $this->runArchivePhpCron(array('--help' => null), PIWIK_INCLUDE_PATH . '/misc/cron/archive.php');
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__Goals.get_month.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__Goals.get_month.xml
index dab33abb44..28c3435722 100644
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__Goals.get_month.xml
+++ b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__Goals.get_month.xml
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="utf-8" ?>
<results>
<result idSite="1">
- <nb_conversions>31</nb_conversions>
- <nb_visits_converted>31</nb_visits_converted>
- <revenue>155</revenue>
- <conversion_rate>93.94%</conversion_rate>
- <nb_conversions_new_visit>31</nb_conversions_new_visit>
+ <nb_conversions>32</nb_conversions>
+ <nb_visits_converted>32</nb_visits_converted>
+ <revenue>160</revenue>
+ <conversion_rate>94.12%</conversion_rate>
+ <nb_conversions_new_visit>32</nb_conversions_new_visit>
<nb_visits_converted_new_visit>31</nb_visits_converted_new_visit>
- <revenue_new_visit>155</revenue_new_visit>
- <conversion_rate_new_visit>93.94%</conversion_rate_new_visit>
+ <revenue_new_visit>160</revenue_new_visit>
+ <conversion_rate_new_visit>91.18%</conversion_rate_new_visit>
</result>
<result idSite="2">
<nb_conversions>0</nb_conversions>
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__VisitFrequency.get_month.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__VisitFrequency.get_month.xml
index 56f4cd45a2..e35d80da08 100644
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__VisitFrequency.get_month.xml
+++ b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__VisitFrequency.get_month.xml
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>
<results>
<result idSite="1">
- <nb_uniq_visitors_new>33</nb_uniq_visitors_new>
+ <nb_uniq_visitors_new>34</nb_uniq_visitors_new>
<nb_users_new>1</nb_users_new>
- <nb_visits_new>33</nb_visits_new>
- <nb_actions_new>36</nb_actions_new>
- <nb_visits_converted_new>31</nb_visits_converted_new>
- <bounce_count_new>31</bounce_count_new>
+ <nb_visits_new>34</nb_visits_new>
+ <nb_actions_new>37</nb_actions_new>
+ <nb_visits_converted_new>32</nb_visits_converted_new>
+ <bounce_count_new>32</bounce_count_new>
<sum_visit_length_new>305</sum_visit_length_new>
<max_actions_new>3</max_actions_new>
<bounce_rate_new>94%</bounce_rate_new>
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__VisitsSummary.get_day.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__VisitsSummary.get_day.xml
index 37a8f92b6c..358388e453 100644
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__VisitsSummary.get_day.xml
+++ b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__VisitsSummary.get_day.xml
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>
<results>
<result idSite="1">
- <nb_uniq_visitors>11</nb_uniq_visitors>
+ <nb_uniq_visitors>12</nb_uniq_visitors>
<nb_users>0</nb_users>
- <nb_visits>11</nb_visits>
- <nb_actions>11</nb_actions>
- <nb_visits_converted>11</nb_visits_converted>
- <bounce_count>11</bounce_count>
+ <nb_visits>12</nb_visits>
+ <nb_actions>12</nb_actions>
+ <nb_visits_converted>12</nb_visits_converted>
+ <bounce_count>12</bounce_count>
<sum_visit_length>0</sum_visit_length>
<max_actions>1</max_actions>
<bounce_rate>100%</bounce_rate>
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__VisitsSummary.get_month.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__VisitsSummary.get_month.xml
index 3526826240..972ae44a47 100644
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__VisitsSummary.get_month.xml
+++ b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__VisitsSummary.get_month.xml
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>
<results>
<result idSite="1">
- <nb_uniq_visitors>33</nb_uniq_visitors>
+ <nb_uniq_visitors>34</nb_uniq_visitors>
<nb_users>1</nb_users>
- <nb_visits>33</nb_visits>
- <nb_actions>36</nb_actions>
- <nb_visits_converted>31</nb_visits_converted>
- <bounce_count>31</bounce_count>
+ <nb_visits>34</nb_visits>
+ <nb_actions>37</nb_actions>
+ <nb_visits_converted>32</nb_visits_converted>
+ <bounce_count>32</bounce_count>
<sum_visit_length>305</sum_visit_length>
<max_actions>3</max_actions>
<bounce_rate>94%</bounce_rate>
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__VisitsSummary.get_week.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__VisitsSummary.get_week.xml
index 425d6d909d..4d2cc269e2 100644
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__VisitsSummary.get_week.xml
+++ b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__VisitsSummary.get_week.xml
@@ -1,15 +1,15 @@
<?xml version="1.0" encoding="utf-8" ?>
<results>
<result idSite="1">
- <nb_uniq_visitors>30</nb_uniq_visitors>
+ <nb_uniq_visitors>31</nb_uniq_visitors>
<nb_users>1</nb_users>
- <nb_visits>30</nb_visits>
- <nb_actions>33</nb_actions>
- <nb_visits_converted>28</nb_visits_converted>
- <bounce_count>28</bounce_count>
+ <nb_visits>31</nb_visits>
+ <nb_actions>34</nb_actions>
+ <nb_visits_converted>29</nb_visits_converted>
+ <bounce_count>29</bounce_count>
<sum_visit_length>305</sum_visit_length>
<max_actions>3</max_actions>
- <bounce_rate>93%</bounce_rate>
+ <bounce_rate>94%</bounce_rate>
<nb_actions_per_visit>1.1</nb_actions_per_visit>
<avg_time_on_site>10</avg_time_on_site>
</result>
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__VisitsSummary.get_year.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__VisitsSummary.get_year.xml
index 79f53c6e57..b503a22410 100644
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__VisitsSummary.get_year.xml
+++ b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__VisitsSummary.get_year.xml
@@ -1,15 +1,15 @@
<?xml version="1.0" encoding="utf-8" ?>
<results>
<result idSite="1">
- <nb_visits>34</nb_visits>
- <nb_actions>46</nb_actions>
- <nb_visits_converted>32</nb_visits_converted>
- <bounce_count>31</bounce_count>
+ <nb_visits>35</nb_visits>
+ <nb_actions>47</nb_actions>
+ <nb_visits_converted>33</nb_visits_converted>
+ <bounce_count>32</bounce_count>
<sum_visit_length>359</sum_visit_length>
<max_actions>10</max_actions>
<bounce_rate>91%</bounce_rate>
- <nb_actions_per_visit>1.4</nb_actions_per_visit>
- <avg_time_on_site>11</avg_time_on_site>
+ <nb_actions_per_visit>1.3</nb_actions_per_visit>
+ <avg_time_on_site>10</avg_time_on_site>
</result>
<result idSite="2">
<nb_visits>1</nb_visits>
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive__Actions.get_range.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive__Actions.get_range.xml
index 8ea3b42ae1..0f379fee74 100644
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive__Actions.get_range.xml
+++ b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive__Actions.get_range.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<result>
- <nb_pageviews>29</nb_pageviews>
- <nb_uniq_pageviews>29</nb_uniq_pageviews>
+ <nb_pageviews>30</nb_pageviews>
+ <nb_uniq_pageviews>30</nb_uniq_pageviews>
<nb_downloads>4</nb_downloads>
<nb_uniq_downloads>4</nb_uniq_downloads>
<nb_outlinks>0</nb_outlinks>
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive__DevicesDetection.getType_range.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive__DevicesDetection.getType_range.xml
index 70f93c6789..98df5eb177 100644
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive__DevicesDetection.getType_range.xml
+++ b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive__DevicesDetection.getType_range.xml
@@ -24,22 +24,22 @@
</row>
<row>
<label>Smartphone</label>
- <nb_visits>2</nb_visits>
- <nb_actions>2</nb_actions>
+ <nb_visits>3</nb_visits>
+ <nb_actions>3</nb_actions>
<max_actions>1</max_actions>
<sum_visit_length>0</sum_visit_length>
- <bounce_count>2</bounce_count>
- <nb_visits_converted>2</nb_visits_converted>
+ <bounce_count>3</bounce_count>
+ <nb_visits_converted>3</nb_visits_converted>
<goals>
<row idgoal='1'>
- <nb_conversions>2</nb_conversions>
- <nb_visits_converted>2</nb_visits_converted>
- <revenue>10</revenue>
+ <nb_conversions>3</nb_conversions>
+ <nb_visits_converted>3</nb_visits_converted>
+ <revenue>15</revenue>
</row>
</goals>
- <nb_conversions>2</nb_conversions>
- <revenue>10</revenue>
- <sum_daily_nb_uniq_visitors>2</sum_daily_nb_uniq_visitors>
+ <nb_conversions>3</nb_conversions>
+ <revenue>15</revenue>
+ <sum_daily_nb_uniq_visitors>3</sum_daily_nb_uniq_visitors>
<sum_daily_nb_users>0</sum_daily_nb_users>
<segment>deviceType==smartphone</segment>
<logo>plugins/Morpheus/icons/dist/devices/smartphone.png</logo>
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive__VisitsSummary.get_range.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive__VisitsSummary.get_range.xml
index 8cf54e7a39..af0d9b8c73 100644
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive__VisitsSummary.get_range.xml
+++ b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive__VisitsSummary.get_range.xml
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>
<result>
- <nb_visits>30</nb_visits>
- <nb_actions>33</nb_actions>
- <nb_visits_converted>28</nb_visits_converted>
- <bounce_count>28</bounce_count>
+ <nb_visits>31</nb_visits>
+ <nb_actions>34</nb_actions>
+ <nb_visits_converted>29</nb_visits_converted>
+ <bounce_count>29</bounce_count>
<sum_visit_length>305</sum_visit_length>
<max_actions>3</max_actions>
- <bounce_rate>93%</bounce_rate>
+ <bounce_rate>94%</bounce_rate>
<nb_actions_per_visit>1.1</nb_actions_per_visit>
<avg_time_on_site>10</avg_time_on_site>
</result> \ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive_before_invalidate__Actions.get_range.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive_before_invalidate__Actions.get_range.xml
new file mode 100644
index 0000000000..0f379fee74
--- /dev/null
+++ b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive_before_invalidate__Actions.get_range.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<result>
+ <nb_pageviews>30</nb_pageviews>
+ <nb_uniq_pageviews>30</nb_uniq_pageviews>
+ <nb_downloads>4</nb_downloads>
+ <nb_uniq_downloads>4</nb_uniq_downloads>
+ <nb_outlinks>0</nb_outlinks>
+ <nb_uniq_outlinks>0</nb_uniq_outlinks>
+ <nb_searches>0</nb_searches>
+ <nb_keywords>0</nb_keywords>
+</result> \ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive_before_invalidate__DevicesDetection.getType_range.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive_before_invalidate__DevicesDetection.getType_range.xml
new file mode 100644
index 0000000000..98df5eb177
--- /dev/null
+++ b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive_before_invalidate__DevicesDetection.getType_range.xml
@@ -0,0 +1,140 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<result>
+ <row>
+ <label>Desktop</label>
+ <nb_visits>26</nb_visits>
+ <nb_actions>29</nb_actions>
+ <max_actions>3</max_actions>
+ <sum_visit_length>305</sum_visit_length>
+ <bounce_count>24</bounce_count>
+ <nb_visits_converted>25</nb_visits_converted>
+ <goals>
+ <row idgoal='1'>
+ <nb_conversions>25</nb_conversions>
+ <nb_visits_converted>25</nb_visits_converted>
+ <revenue>125</revenue>
+ </row>
+ </goals>
+ <nb_conversions>25</nb_conversions>
+ <revenue>125</revenue>
+ <sum_daily_nb_uniq_visitors>26</sum_daily_nb_uniq_visitors>
+ <sum_daily_nb_users>1</sum_daily_nb_users>
+ <segment>deviceType==desktop</segment>
+ <logo>plugins/Morpheus/icons/dist/devices/desktop.png</logo>
+ </row>
+ <row>
+ <label>Smartphone</label>
+ <nb_visits>3</nb_visits>
+ <nb_actions>3</nb_actions>
+ <max_actions>1</max_actions>
+ <sum_visit_length>0</sum_visit_length>
+ <bounce_count>3</bounce_count>
+ <nb_visits_converted>3</nb_visits_converted>
+ <goals>
+ <row idgoal='1'>
+ <nb_conversions>3</nb_conversions>
+ <nb_visits_converted>3</nb_visits_converted>
+ <revenue>15</revenue>
+ </row>
+ </goals>
+ <nb_conversions>3</nb_conversions>
+ <revenue>15</revenue>
+ <sum_daily_nb_uniq_visitors>3</sum_daily_nb_uniq_visitors>
+ <sum_daily_nb_users>0</sum_daily_nb_users>
+ <segment>deviceType==smartphone</segment>
+ <logo>plugins/Morpheus/icons/dist/devices/smartphone.png</logo>
+ </row>
+ <row>
+ <label>Unknown</label>
+ <nb_visits>2</nb_visits>
+ <nb_actions>2</nb_actions>
+ <max_actions>1</max_actions>
+ <sum_visit_length>0</sum_visit_length>
+ <bounce_count>2</bounce_count>
+ <nb_visits_converted>1</nb_visits_converted>
+ <goals>
+ <row idgoal='1'>
+ <nb_conversions>1</nb_conversions>
+ <nb_visits_converted>1</nb_visits_converted>
+ <revenue>5</revenue>
+ </row>
+ </goals>
+ <nb_conversions>1</nb_conversions>
+ <revenue>5</revenue>
+ <sum_daily_nb_uniq_visitors>2</sum_daily_nb_uniq_visitors>
+ <sum_daily_nb_users>0</sum_daily_nb_users>
+ <logo>plugins/Morpheus/icons/dist/devices/unknown.png</logo>
+ </row>
+ <row>
+ <label>Camera</label>
+ <nb_visits>0</nb_visits>
+ <segment>deviceType==camera</segment>
+ <logo>plugins/Morpheus/icons/dist/devices/camera.png</logo>
+ </row>
+ <row>
+ <label>Car browser</label>
+ <nb_visits>0</nb_visits>
+ <segment>deviceType==car+browser</segment>
+ <logo>plugins/Morpheus/icons/dist/devices/car_browser.png</logo>
+ </row>
+ <row>
+ <label>Console</label>
+ <nb_visits>0</nb_visits>
+ <segment>deviceType==console</segment>
+ <logo>plugins/Morpheus/icons/dist/devices/console.png</logo>
+ </row>
+ <row>
+ <label>Feature phone</label>
+ <nb_visits>0</nb_visits>
+ <segment>deviceType==feature+phone</segment>
+ <logo>plugins/Morpheus/icons/dist/devices/feature_phone.png</logo>
+ </row>
+ <row>
+ <label>Peripheral</label>
+ <nb_visits>0</nb_visits>
+ <segment>deviceType==peripheral</segment>
+ <logo>plugins/Morpheus/icons/dist/devices/peripheral.png</logo>
+ </row>
+ <row>
+ <label>Phablet</label>
+ <nb_visits>0</nb_visits>
+ <segment>deviceType==phablet</segment>
+ <logo>plugins/Morpheus/icons/dist/devices/phablet.png</logo>
+ </row>
+ <row>
+ <label>Portable media player</label>
+ <nb_visits>0</nb_visits>
+ <segment>deviceType==portable+media+player</segment>
+ <logo>plugins/Morpheus/icons/dist/devices/portable_media_player.png</logo>
+ </row>
+ <row>
+ <label>Smart display</label>
+ <nb_visits>0</nb_visits>
+ <segment>deviceType==smart+display</segment>
+ <logo>plugins/Morpheus/icons/dist/devices/smart_display.png</logo>
+ </row>
+ <row>
+ <label>Smart speaker</label>
+ <nb_visits>0</nb_visits>
+ <segment>deviceType==smart+speaker</segment>
+ <logo>plugins/Morpheus/icons/dist/devices/smart_speaker.png</logo>
+ </row>
+ <row>
+ <label>Tablet</label>
+ <nb_visits>0</nb_visits>
+ <segment>deviceType==tablet</segment>
+ <logo>plugins/Morpheus/icons/dist/devices/tablet.png</logo>
+ </row>
+ <row>
+ <label>Tv</label>
+ <nb_visits>0</nb_visits>
+ <segment>deviceType==tv</segment>
+ <logo>plugins/Morpheus/icons/dist/devices/tv.png</logo>
+ </row>
+ <row>
+ <label>Wearable</label>
+ <nb_visits>0</nb_visits>
+ <segment>deviceType==wearable</segment>
+ <logo>plugins/Morpheus/icons/dist/devices/wearable.png</logo>
+ </row>
+</result> \ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive_before_invalidate__VisitsSummary.get_range.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive_before_invalidate__VisitsSummary.get_range.xml
new file mode 100644
index 0000000000..af0d9b8c73
--- /dev/null
+++ b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive_before_invalidate__VisitsSummary.get_range.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<result>
+ <nb_visits>31</nb_visits>
+ <nb_actions>34</nb_actions>
+ <nb_visits_converted>29</nb_visits_converted>
+ <bounce_count>29</bounce_count>
+ <sum_visit_length>305</sum_visit_length>
+ <max_actions>3</max_actions>
+ <bounce_rate>94%</bounce_rate>
+ <nb_actions_per_visit>1.1</nb_actions_per_visit>
+ <avg_time_on_site>10</avg_time_on_site>
+</result> \ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive_rearchived__Actions.get_range.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive_rearchived__Actions.get_range.xml
new file mode 100644
index 0000000000..b3451748fd
--- /dev/null
+++ b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive_rearchived__Actions.get_range.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<result>
+ <nb_pageviews>31</nb_pageviews>
+ <nb_uniq_pageviews>31</nb_uniq_pageviews>
+ <nb_downloads>4</nb_downloads>
+ <nb_uniq_downloads>4</nb_uniq_downloads>
+ <nb_outlinks>0</nb_outlinks>
+ <nb_uniq_outlinks>0</nb_uniq_outlinks>
+ <nb_searches>0</nb_searches>
+ <nb_keywords>0</nb_keywords>
+</result> \ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive_rearchived__DevicesDetection.getType_range.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive_rearchived__DevicesDetection.getType_range.xml
new file mode 100644
index 0000000000..a8f2821894
--- /dev/null
+++ b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive_rearchived__DevicesDetection.getType_range.xml
@@ -0,0 +1,140 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<result>
+ <row>
+ <label>Desktop</label>
+ <nb_visits>26</nb_visits>
+ <nb_actions>29</nb_actions>
+ <max_actions>3</max_actions>
+ <sum_visit_length>305</sum_visit_length>
+ <bounce_count>24</bounce_count>
+ <nb_visits_converted>25</nb_visits_converted>
+ <goals>
+ <row idgoal='1'>
+ <nb_conversions>25</nb_conversions>
+ <nb_visits_converted>25</nb_visits_converted>
+ <revenue>125</revenue>
+ </row>
+ </goals>
+ <nb_conversions>25</nb_conversions>
+ <revenue>125</revenue>
+ <sum_daily_nb_uniq_visitors>26</sum_daily_nb_uniq_visitors>
+ <sum_daily_nb_users>1</sum_daily_nb_users>
+ <segment>deviceType==desktop</segment>
+ <logo>plugins/Morpheus/icons/dist/devices/desktop.png</logo>
+ </row>
+ <row>
+ <label>Smartphone</label>
+ <nb_visits>4</nb_visits>
+ <nb_actions>4</nb_actions>
+ <max_actions>1</max_actions>
+ <sum_visit_length>0</sum_visit_length>
+ <bounce_count>4</bounce_count>
+ <nb_visits_converted>4</nb_visits_converted>
+ <goals>
+ <row idgoal='1'>
+ <nb_conversions>4</nb_conversions>
+ <nb_visits_converted>4</nb_visits_converted>
+ <revenue>20</revenue>
+ </row>
+ </goals>
+ <nb_conversions>4</nb_conversions>
+ <revenue>20</revenue>
+ <sum_daily_nb_uniq_visitors>4</sum_daily_nb_uniq_visitors>
+ <sum_daily_nb_users>0</sum_daily_nb_users>
+ <segment>deviceType==smartphone</segment>
+ <logo>plugins/Morpheus/icons/dist/devices/smartphone.png</logo>
+ </row>
+ <row>
+ <label>Unknown</label>
+ <nb_visits>2</nb_visits>
+ <nb_actions>2</nb_actions>
+ <max_actions>1</max_actions>
+ <sum_visit_length>0</sum_visit_length>
+ <bounce_count>2</bounce_count>
+ <nb_visits_converted>1</nb_visits_converted>
+ <goals>
+ <row idgoal='1'>
+ <nb_conversions>1</nb_conversions>
+ <nb_visits_converted>1</nb_visits_converted>
+ <revenue>5</revenue>
+ </row>
+ </goals>
+ <nb_conversions>1</nb_conversions>
+ <revenue>5</revenue>
+ <sum_daily_nb_uniq_visitors>2</sum_daily_nb_uniq_visitors>
+ <sum_daily_nb_users>0</sum_daily_nb_users>
+ <logo>plugins/Morpheus/icons/dist/devices/unknown.png</logo>
+ </row>
+ <row>
+ <label>Camera</label>
+ <nb_visits>0</nb_visits>
+ <segment>deviceType==camera</segment>
+ <logo>plugins/Morpheus/icons/dist/devices/camera.png</logo>
+ </row>
+ <row>
+ <label>Car browser</label>
+ <nb_visits>0</nb_visits>
+ <segment>deviceType==car+browser</segment>
+ <logo>plugins/Morpheus/icons/dist/devices/car_browser.png</logo>
+ </row>
+ <row>
+ <label>Console</label>
+ <nb_visits>0</nb_visits>
+ <segment>deviceType==console</segment>
+ <logo>plugins/Morpheus/icons/dist/devices/console.png</logo>
+ </row>
+ <row>
+ <label>Feature phone</label>
+ <nb_visits>0</nb_visits>
+ <segment>deviceType==feature+phone</segment>
+ <logo>plugins/Morpheus/icons/dist/devices/feature_phone.png</logo>
+ </row>
+ <row>
+ <label>Peripheral</label>
+ <nb_visits>0</nb_visits>
+ <segment>deviceType==peripheral</segment>
+ <logo>plugins/Morpheus/icons/dist/devices/peripheral.png</logo>
+ </row>
+ <row>
+ <label>Phablet</label>
+ <nb_visits>0</nb_visits>
+ <segment>deviceType==phablet</segment>
+ <logo>plugins/Morpheus/icons/dist/devices/phablet.png</logo>
+ </row>
+ <row>
+ <label>Portable media player</label>
+ <nb_visits>0</nb_visits>
+ <segment>deviceType==portable+media+player</segment>
+ <logo>plugins/Morpheus/icons/dist/devices/portable_media_player.png</logo>
+ </row>
+ <row>
+ <label>Smart display</label>
+ <nb_visits>0</nb_visits>
+ <segment>deviceType==smart+display</segment>
+ <logo>plugins/Morpheus/icons/dist/devices/smart_display.png</logo>
+ </row>
+ <row>
+ <label>Smart speaker</label>
+ <nb_visits>0</nb_visits>
+ <segment>deviceType==smart+speaker</segment>
+ <logo>plugins/Morpheus/icons/dist/devices/smart_speaker.png</logo>
+ </row>
+ <row>
+ <label>Tablet</label>
+ <nb_visits>0</nb_visits>
+ <segment>deviceType==tablet</segment>
+ <logo>plugins/Morpheus/icons/dist/devices/tablet.png</logo>
+ </row>
+ <row>
+ <label>Tv</label>
+ <nb_visits>0</nb_visits>
+ <segment>deviceType==tv</segment>
+ <logo>plugins/Morpheus/icons/dist/devices/tv.png</logo>
+ </row>
+ <row>
+ <label>Wearable</label>
+ <nb_visits>0</nb_visits>
+ <segment>deviceType==wearable</segment>
+ <logo>plugins/Morpheus/icons/dist/devices/wearable.png</logo>
+ </row>
+</result> \ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive_rearchived__VisitsSummary.get_range.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive_rearchived__VisitsSummary.get_range.xml
new file mode 100644
index 0000000000..9af550f04d
--- /dev/null
+++ b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive_rearchived__VisitsSummary.get_range.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<result>
+ <nb_visits>32</nb_visits>
+ <nb_actions>35</nb_actions>
+ <nb_visits_converted>30</nb_visits_converted>
+ <bounce_count>30</bounce_count>
+ <sum_visit_length>305</sum_visit_length>
+ <max_actions>3</max_actions>
+ <bounce_rate>94%</bounce_rate>
+ <nb_actions_per_visit>1.1</nb_actions_per_visit>
+ <avg_time_on_site>10</avg_time_on_site>
+</result> \ No newline at end of file