diff options
author | diosmosis <diosmosis@users.noreply.github.com> | 2020-12-04 01:45:46 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-04 01:45:46 +0300 |
commit | 3908593cfee10792c5e4cc970f8227cefb23412e (patch) | |
tree | a37e924ca9bd74b7ce723488fd4cdb3305f38937 | |
parent | d81b5cf0426b029c1ac5cdbaa084d1e7f55e5d50 (diff) |
segment invalidations must be paired w/ normal invalidations (#16845)
10 files changed, 365 insertions, 157 deletions
diff --git a/core/CronArchive.php b/core/CronArchive.php index 07754b5a0d..3fb20a58fd 100644 --- a/core/CronArchive.php +++ b/core/CronArchive.php @@ -28,7 +28,6 @@ use Piwik\DataAccess\Model; use Piwik\DataAccess\RawLogDao; use Piwik\Exception\UnexpectedWebsiteFoundException; use Piwik\Metrics\Formatter; -use Piwik\Period\Factory; use Piwik\Period\Factory as PeriodFactory; use Piwik\CronArchive\SegmentArchiving; use Piwik\Period\Range; @@ -785,20 +784,12 @@ class CronArchive //Concurrent transaction logic will end up with duplicates set. Adding array_unique to the siteIds. $siteIds = array_unique($siteIds); - $period = Factory::build('day', $date); - $siteIdsToInvalidate = []; foreach ($siteIds as $idSite) { if ($idSite != $idSiteToInvalidate) { continue; } - $params = new Parameters(new Site($idSite), $period, new Segment('', [$idSite], $period->getDateStart(), $period->getDateEnd())); - if ($this->isThereExistingValidPeriod($params)) { - $this->logger->debug(' Found usable archive for date range {date} for site {idSite}, skipping invalidation for now.', ['date' => $date, 'idSite' => $idSite]); - continue; - } - $siteIdsToInvalidate[] = $idSite; } @@ -810,7 +801,7 @@ class CronArchive try { $this->logger->debug(' Will invalidate archived reports for ' . $date . ' for following websites ids: ' . $listSiteIds); - $this->getApiToInvalidateArchivedReport()->invalidateArchivedReports($siteIdsToInvalidate, $date); + $this->invalidateWithSegments($siteIdsToInvalidate, $date, $period = 'day'); } catch (Exception $e) { $message = ExceptionToTextProcessor::getMessageAndWholeBacktrace($e); $this->logger->info(' Failed to invalidate archived reports: ' . $message); @@ -829,21 +820,15 @@ class CronArchive foreach ($dates as $date) { try { - $period = PeriodFactory::build('range', $date); + PeriodFactory::build('range', $date); } catch (\Exception $ex) { $this->logger->debug(" Found invalid range date in [General] archiving_custom_ranges: {date}", ['date' => $date]); continue; } - $params = new Parameters(new Site($idSiteToInvalidate), $period, new Segment('', [$idSiteToInvalidate], $period->getDateStart(), $period->getDateEnd())); - if ($this->isThereExistingValidPeriod($params)) { - $this->logger->debug(' Found usable archive for custom date range {date} for site {idSite}, skipping archiving.', ['date' => $date, 'idSite' => $idSiteToInvalidate]); - continue; - } - $this->logger->debug(' Invalidating custom date range ({date}) for site {idSite}', ['idSite' => $idSiteToInvalidate, 'date' => $date]); - $this->getApiToInvalidateArchivedReport()->invalidateArchivedReports($idSiteToInvalidate, [$date], 'range', $segment = null, $cascadeDown = false, $_forceInvalidateNonexistant = true); + $this->invalidateWithSegments($idSiteToInvalidate, $date, 'range', $_forceInvalidateNonexistant = true); } // for new segments, invalidate past dates @@ -871,18 +856,13 @@ class CronArchive $this->logger->debug("Done invalidating"); } - private function invalidateRecentDate($dateStr, $idSite) + public function invalidateRecentDate($dateStr, $idSite) { - $isYesterday = $dateStr == 'yesterday'; - - $date = Date::factory($dateStr); + $timezone = Site::getTimezoneFor($idSite); + $date = Date::factoryInTimezone($dateStr, $timezone); $period = PeriodFactory::build('day', $date); $params = new Parameters(new Site($idSite), $period, new Segment('', [$idSite], $period->getDateStart(), $period->getDateEnd())); - if ($this->isThereExistingValidPeriod($params, $isYesterday)) { - $this->logger->debug(" Found existing valid archive for $dateStr, skipping invalidation..."); - return; - } $loader = new Loader($params); if ($loader->canSkipThisArchive()) { @@ -895,13 +875,52 @@ class CronArchive 'date' => $date->getDatetime(), ]); - $this->getApiToInvalidateArchivedReport()->invalidateArchivedReports($idSite, $date->toString(), 'day'); + $this->invalidateWithSegments([$idSite], $date->toString(), 'day'); + } + + private function invalidateWithSegments($idSites, $date, $period, $_forceInvalidateNonexistant = false) + { + if ($date instanceof Date) { + $date = $date->toString(); + } + + $periodObj = PeriodFactory::build($period, $date); + + if ($period == 'range') { + $date = [$date]; // so we don't split on the ',' in invalidateArchivedReports + } + + if (!is_array($idSites)) { + $idSites = [$idSites]; + } + + foreach ($idSites as $idSite) { + $params = new Parameters(new Site($idSite), $periodObj, new Segment('', [$idSite], $periodObj->getDateStart(), $periodObj->getDateEnd())); + if ($this->isThereExistingValidPeriod($params)) { + $this->logger->debug(' Found usable archive for {archive}, skipping invalidation.', ['archive' => $params]); + } else { + $this->getApiToInvalidateArchivedReport()->invalidateArchivedReports($idSite, $date, $period, $segment = false, $cascadeDown = false, + $_forceInvalidateNonexistant); + } + + foreach ($this->segmentArchiving->getAllSegmentsToArchive($idSite) as $segment) { + $params = new Parameters(new Site($idSite), $periodObj, new Segment($segment['definition'], [$idSite], $periodObj->getDateStart(), $periodObj->getDateEnd())); + if ($this->isThereExistingValidPeriod($params)) { + $this->logger->debug(' Found usable archive for {archive}, skipping invalidation.', ['archive' => $params]); + } else { + $this->getApiToInvalidateArchivedReport()->invalidateArchivedReports($idSite, $date, $period, $segment['definition'], + $cascadeDown = false, $_forceInvalidateNonexistant); + } + } + } } - public function isThereExistingValidPeriod(Parameters $params, $isYesterday = false) + public function isThereExistingValidPeriod(Parameters $params) { $today = Date::factoryInTimezone('today', Site::getTimezoneFor($params->getSite()->getId())); + $isYesterday = $params->getPeriod()->getLabel() == 'day' && $params->getPeriod()->getDateStart()->toString() == Date::factory('yesterday')->toString(); + $isPeriodIncludesToday = $params->getPeriod()->isDateInPeriod($today); $minArchiveProcessedTime = $isPeriodIncludesToday ? Date::now()->subSeconds(Rules::getPeriodArchiveTimeToLiveDefault($params->getPeriod()->getLabel())) : null; diff --git a/core/CronArchive/SegmentArchiving.php b/core/CronArchive/SegmentArchiving.php index ba2c2a4790..16b58baeed 100644 --- a/core/CronArchive/SegmentArchiving.php +++ b/core/CronArchive/SegmentArchiving.php @@ -279,6 +279,21 @@ class SegmentArchiving return $this->segmentListCache->fetch('all'); } + public function getAllSegmentsToArchive($idSite) + { + $segments = []; + foreach ($this->getAllSegments() as $segment) { + if (!$this->isAutoArchivingEnabledFor($segment) + || !$this->isSegmentForSite($segment, $idSite) + ) { + continue; + } + + $segments[] = $segment; + } + return $segments; + } + private function isSegmentForSite($segment, $idSite) { return $segment['enable_only_idsite'] == 0 diff --git a/plugins/CoreConsole/tests/System/ArchiveCronTest.php b/plugins/CoreConsole/tests/System/ArchiveCronTest.php index a3860198f5..35063a1951 100644 --- a/plugins/CoreConsole/tests/System/ArchiveCronTest.php +++ b/plugins/CoreConsole/tests/System/ArchiveCronTest.php @@ -8,6 +8,7 @@ namespace Piwik\Plugins\CoreConsole\tests\System; use Piwik\CronArchive; +use Piwik\Plugins\SegmentEditor\API; use Psr\Container\ContainerInterface; use Piwik\Archive\ArchiveInvalidator; use Piwik\Common; @@ -36,6 +37,9 @@ use Psr\Log\LoggerInterface; */ class ArchiveCronTest extends SystemTestCase { + const NEW_SEGMENT = 'operatingSystemCode==IOS'; + const NEW_SEGMENT_NAME = 'segmentForToday'; + /** * @var ManySitesImportedLogs */ @@ -48,6 +52,29 @@ class ArchiveCronTest extends SystemTestCase Db::exec("UPDATE " . Common::prefixTable('site') . ' SET ts_created = \'2005-01-02 00:00:00\''); } + private static function addNewSegmentToPast() + { + // add one segment and set it's created/updated time to some time in the past so we don't re-archive for it + Config::getInstance()->General['enable_browser_archiving_triggering'] = 0; + $idSegment = API::getInstance()->add(self::NEW_SEGMENT_NAME, self::NEW_SEGMENT, self::$fixture->idSite, $autoArchive = 1, $enabledAllUsers = 1); + Config::getInstance()->General['enable_browser_archiving_triggering'] = 1; + Db::exec("UPDATE " . Common::prefixTable('segment') . ' SET ts_created = \'2015-01-02 00:00:00\', ts_last_edit = \'2015-01-02 00:00:00\' WHERE idsegment = ' . $idSegment); + } + + private static function trackVisitsForToday() + { + $startTime = Date::today()->addHour(12)->getDatetime(); + + $t = Fixture::getTracker(self::$fixture->idSite, $startTime); + $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://awebsite.com/here/we/go'); + Fixture::checkResponse($t->doTrackPageView('a page title')); + + $t->setUrl('http://awebsite.com/another/page'); + $t->setForceVisitDateTime(Date::factory($startTime)->addHour(1)); + Fixture::checkResponse($t->doTrackPageView('a second page title')); + } + public function getApiForTesting() { $apiRequiringSegments = ['Goals.get', 'VisitFrequency.get']; @@ -62,6 +89,12 @@ class ArchiveCronTest extends SystemTestCase 'testSuffix' => '_' . $segmentName)); } + $results[] = array('VisitsSummary.get', array('idSite' => 'all', + 'date' => 'today', + 'periods' => ['day', 'week', 'month', 'year'], + 'segment' => self::NEW_SEGMENT, + 'testSuffix' => '_' . self::NEW_SEGMENT_NAME)); + // ExamplePlugin metric $results[] = ['ExamplePlugin.getExampleArchivedMetric', [ 'idSite' => 'all', @@ -116,6 +149,12 @@ class ArchiveCronTest extends SystemTestCase public function testArchivePhpCron() { + self::$fixture->getTestEnvironment()->overrideConfig('General', 'enable_browser_archiving_triggering', 0); + self::$fixture->getTestEnvironment()->overrideConfig('General', 'browser_archiving_disabled_enforce', 1); + + Config::getInstance()->General['enable_browser_archiving_triggering'] = 0; + Config::getInstance()->General['browser_archiving_disabled_enforce'] = 1; + // invalidate exampleplugin only archives in past $invalidator = StaticContainer::get(ArchiveInvalidator::class); $invalidator->markArchivesAsInvalidated( @@ -135,6 +174,12 @@ class ArchiveCronTest extends SystemTestCase Option::delete(CronArchive::CRON_INVALIDATION_TIME_OPTION_NAME); $output = $this->runArchivePhpCron(); // have to run twice since we manually invalidate above + // add new segment w/ edited created/edit time so it will not trigger segment re-archiving, then track a visit + // so the segments will be archived w/ other invalidation + self::addNewSegmentToPast(); + self::trackVisitsForToday(); + $output = $this->runArchivePhpCron(); + $expectedInvalidations = []; $invalidationEntries = $this->getInvalidatedArchiveTableEntries(); $this->assertEquals($expectedInvalidations, $invalidationEntries); @@ -164,6 +209,12 @@ class ArchiveCronTest extends SystemTestCase */ public function testArchivePhpCronWithSingleReportRearchive() { + self::$fixture->getTestEnvironment()->overrideConfig('General', 'enable_browser_archiving_triggering', 0); + self::$fixture->getTestEnvironment()->overrideConfig('General', 'browser_archiving_disabled_enforce', 1); + + Config::getInstance()->General['enable_browser_archiving_triggering'] = 0; + Config::getInstance()->General['browser_archiving_disabled_enforce'] = 1; + // invalidate a report so we get a partial archive (using the metric that gets incremented each time it is archived) // (do it after the last run so we don't end up just re-using the ExamplePlugin archive) $invalidator = StaticContainer::get(ArchiveInvalidator::class); diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentForToday_noOptions__VisitsSummary.get_day.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentForToday_noOptions__VisitsSummary.get_day.xml new file mode 100644 index 0000000000..907663817a --- /dev/null +++ b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentForToday_noOptions__VisitsSummary.get_day.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="utf-8" ?> +<results> + <result idSite="1"> + <nb_uniq_visitors>1</nb_uniq_visitors> + <nb_users>0</nb_users> + <nb_visits>2</nb_visits> + <nb_actions>2</nb_actions> + <nb_visits_converted>2</nb_visits_converted> + <bounce_count>2</bounce_count> + <sum_visit_length>0</sum_visit_length> + <max_actions>1</max_actions> + <bounce_rate>100%</bounce_rate> + <nb_actions_per_visit>1</nb_actions_per_visit> + <avg_time_on_site>0</avg_time_on_site> + </result> + <result idSite="2" /> + <result idSite="3" /> +</results>
\ No newline at end of file diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentForToday_noOptions__VisitsSummary.get_month.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentForToday_noOptions__VisitsSummary.get_month.xml new file mode 100644 index 0000000000..907663817a --- /dev/null +++ b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentForToday_noOptions__VisitsSummary.get_month.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="utf-8" ?> +<results> + <result idSite="1"> + <nb_uniq_visitors>1</nb_uniq_visitors> + <nb_users>0</nb_users> + <nb_visits>2</nb_visits> + <nb_actions>2</nb_actions> + <nb_visits_converted>2</nb_visits_converted> + <bounce_count>2</bounce_count> + <sum_visit_length>0</sum_visit_length> + <max_actions>1</max_actions> + <bounce_rate>100%</bounce_rate> + <nb_actions_per_visit>1</nb_actions_per_visit> + <avg_time_on_site>0</avg_time_on_site> + </result> + <result idSite="2" /> + <result idSite="3" /> +</results>
\ No newline at end of file diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentForToday_noOptions__VisitsSummary.get_week.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentForToday_noOptions__VisitsSummary.get_week.xml new file mode 100644 index 0000000000..907663817a --- /dev/null +++ b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentForToday_noOptions__VisitsSummary.get_week.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="utf-8" ?> +<results> + <result idSite="1"> + <nb_uniq_visitors>1</nb_uniq_visitors> + <nb_users>0</nb_users> + <nb_visits>2</nb_visits> + <nb_actions>2</nb_actions> + <nb_visits_converted>2</nb_visits_converted> + <bounce_count>2</bounce_count> + <sum_visit_length>0</sum_visit_length> + <max_actions>1</max_actions> + <bounce_rate>100%</bounce_rate> + <nb_actions_per_visit>1</nb_actions_per_visit> + <avg_time_on_site>0</avg_time_on_site> + </result> + <result idSite="2" /> + <result idSite="3" /> +</results>
\ No newline at end of file diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentForToday_noOptions__VisitsSummary.get_year.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentForToday_noOptions__VisitsSummary.get_year.xml new file mode 100644 index 0000000000..079f977d9b --- /dev/null +++ b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentForToday_noOptions__VisitsSummary.get_year.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8" ?> +<results> + <result idSite="1"> + <nb_visits>2</nb_visits> + <nb_actions>2</nb_actions> + <nb_visits_converted>2</nb_visits_converted> + <bounce_count>2</bounce_count> + <sum_visit_length>0</sum_visit_length> + <max_actions>1</max_actions> + <bounce_rate>100%</bounce_rate> + <nb_actions_per_visit>1</nb_actions_per_visit> + <avg_time_on_site>0</avg_time_on_site> + </result> + <result idSite="2" /> + <result idSite="3" /> +</results>
\ No newline at end of file diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_singleMetric__ExamplePlugin.getExampleArchivedMetric_day.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_singleMetric__ExamplePlugin.getExampleArchivedMetric_day.xml index 8be8d54d20..77306ca768 100644 --- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_singleMetric__ExamplePlugin.getExampleArchivedMetric_day.xml +++ b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_singleMetric__ExamplePlugin.getExampleArchivedMetric_day.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8" ?> <results> <result idSite="1"> - <ExamplePlugin_example_metric>3382</ExamplePlugin_example_metric> + <ExamplePlugin_example_metric>0</ExamplePlugin_example_metric> <ExamplePlugin_example_metric2>1</ExamplePlugin_example_metric2> </result> <result idSite="2" /> diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_singleMetric__ExamplePlugin.getExampleArchivedMetric_week.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_singleMetric__ExamplePlugin.getExampleArchivedMetric_week.xml index 8be8d54d20..77306ca768 100644 --- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_singleMetric__ExamplePlugin.getExampleArchivedMetric_week.xml +++ b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_singleMetric__ExamplePlugin.getExampleArchivedMetric_week.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8" ?> <results> <result idSite="1"> - <ExamplePlugin_example_metric>3382</ExamplePlugin_example_metric> + <ExamplePlugin_example_metric>0</ExamplePlugin_example_metric> <ExamplePlugin_example_metric2>1</ExamplePlugin_example_metric2> </result> <result idSite="2" /> diff --git a/tests/PHPUnit/Integration/CronArchiveTest.php b/tests/PHPUnit/Integration/CronArchiveTest.php index 4a1719f346..26830b4820 100644 --- a/tests/PHPUnit/Integration/CronArchiveTest.php +++ b/tests/PHPUnit/Integration/CronArchiveTest.php @@ -8,6 +8,7 @@ namespace Piwik\Tests\Integration; +use Monolog\Logger; use Piwik\ArchiveProcessor\Parameters; use Piwik\ArchiveProcessor\Rules; use Piwik\Container\StaticContainer; @@ -34,6 +35,130 @@ use Psr\Log\NullLogger; */ class CronArchiveTest extends IntegrationTestCase { + /** + * @dataProvider getTestDataForInvalidateRecentDate + */ + public function test_invalidateRecentDate_invalidatesCorrectPeriodsAndSegments($dateStr, $segments, + $expectedInvalidationCalls) + { + $idSite = Fixture::createWebsite('2019-04-04 03:45:45', 0, false, false, 1, null, null, 'Australia/Sydney'); + + Rules::setBrowserTriggerArchiving(false); + foreach ($segments as $idx => $segment) { + SegmentAPI::getInstance()->add('segment #' . $idx, $segment, $idx % 2 === 0 ? $idSite : false, true, true); + } + Rules::setBrowserTriggerArchiving(true); + + $t = Fixture::getTracker($idSite, Date::yesterday()->addHour(2)->getDatetime()); + $t->setUrl('http://someurl.com/abc'); + Fixture::checkResponse($t->doTrackPageView('some page')); + + $t = Fixture::getTracker($idSite, Date::today()->addHour(2)->getDatetime()); + $t->setUrl('http://someurl.com/def'); + Fixture::checkResponse($t->doTrackPageView('some page 2')); + + $mockInvalidateApi = $this->getMockInvalidateApi(); + + $archiver = new CronArchive(); + $archiver->init(); + $archiver->setApiToInvalidateArchivedReport($mockInvalidateApi); + + $archiver->invalidateRecentDate($dateStr, $idSite); + + $actualInvalidationCalls = $mockInvalidateApi->getInvalidations(); + + $this->assertEquals($expectedInvalidationCalls, $actualInvalidationCalls); + } + + public function getTestDataForInvalidateRecentDate() + { + $segments = [ + 'browserCode==IE', + 'visitCount>5', + ]; + + return [ + [ + 'today', + $segments, + [ + array ( + 1, + '2020-02-03', + 'day', + false, + false, + false, + ), + array ( + 1, + '2020-02-03', + 'day', + 'browserCode==IE', + false, + false, + ), + array ( + 1, + '2020-02-03', + 'day', + 'visitCount>5', + false, + false, + ), + ], + ], + [ + 'yesterday', + $segments, + [ + array ( + 1, + '2020-02-02', + 'day', + false, + false, + false, + ), + array ( + 1, + '2020-02-02', + 'day', + 'browserCode==IE', + false, + false, + ), + array ( + 1, + '2020-02-02', + 'day', + 'visitCount>5', + false, + false, + ), + ], + ], + ]; + } + + private function getMockInvalidateApi() + { + $mock = new class { + private $calls = []; + + public function invalidateArchivedReports() + { + $this->calls[] = func_get_args(); + } + + public function getInvalidations() + { + return $this->calls; + } + }; + return $mock; + } + public function test_isThereExistingValidPeriod_returnsTrueIfPeriodHasToday_AndExistingArchiveIsNewEnough() { Fixture::createWebsite('2019-04-04 03:45:45'); @@ -51,7 +176,7 @@ class CronArchiveTest extends IntegrationTestCase 1, 1,2, '2020-03-30', '2020-04-05', 'done', ArchiveWriter::DONE_OK, $tsArchived ]); - $actual =$archiver->isThereExistingValidPeriod($params, $isYesterday = false); + $actual =$archiver->isThereExistingValidPeriod($params); $this->assertTrue($actual); } @@ -166,20 +291,18 @@ class CronArchiveTest extends IntegrationTestCase */ $invalidatedReports = $api->getInvalidatedReports(); $this->assertCount(3, $invalidatedReports); - sort($invalidatedReports[0][0]); - sort($invalidatedReports[1][0]); - sort($invalidatedReports[2][0]); + usort($invalidatedReports, function ($a, $b) { return strcmp($a[1], $b[1]); }); - $this->assertSame(array(1), $invalidatedReports[0][0]); + $this->assertSame(1, $invalidatedReports[0][0]); $this->assertSame('2014-04-05', $invalidatedReports[0][1]); - $this->assertSame(array(2), $invalidatedReports[1][0]); + $this->assertSame(2, $invalidatedReports[1][0]); $this->assertSame('2014-04-05', $invalidatedReports[1][1]); - $this->assertSame(array(2), $invalidatedReports[2][0]); + $this->assertSame(2, $invalidatedReports[2][0]); $this->assertSame('2014-04-06', $invalidatedReports[2][1]); } @@ -307,148 +430,78 @@ Checking for queued invalidations... Segment "actions>=2" was created or changed recently and will therefore archive today (for site ID = 1) Segment "actions>=4" was created or changed recently and will therefore archive today (for site ID = 1) Done invalidating -Skipping invalidated archive 73, segment 'actions>=4' is not in --force-idsegments: [idinvalidation = 73, idsite = 1, period = day(2020-02-03 - 2020-02-03), name = done49a9440bd6dba4b8850035e09d043c67] -No usable archive exists (ts_archived of existing = , now = 2020-02-03 04:05:06). -Found invalidated archive we can skip (no visits): [idinvalidation = 43, idsite = 1, period = day(2020-02-03 - 2020-02-03), name = donee0512c03f7c20af6ef96a8d792c6bb9f] -Skipping invalidated archive 74, segment 'actions>=4' is not in --force-idsegments: [idinvalidation = 74, idsite = 1, period = week(2020-02-03 - 2020-02-09), name = done49a9440bd6dba4b8850035e09d043c67] -No usable archive exists (ts_archived of existing = , now = 2020-02-03 04:05:06). -Found invalidated archive we can skip (no visits): [idinvalidation = 44, idsite = 1, period = week(2020-02-03 - 2020-02-09), name = donee0512c03f7c20af6ef96a8d792c6bb9f] -Skipping invalidated archive 72, segment 'actions>=4' is not in --force-idsegments: [idinvalidation = 72, idsite = 1, period = day(2020-02-02 - 2020-02-02), name = done49a9440bd6dba4b8850035e09d043c67] -No usable archive exists (ts_archived of existing = , now = 2020-02-03 04:05:06). -Found invalidated archive we can skip (no visits): [idinvalidation = 42, idsite = 1, period = day(2020-02-02 - 2020-02-02), name = donee0512c03f7c20af6ef96a8d792c6bb9f] -Skipping invalidated archive 70, segment 'actions>=4' is not in --force-idsegments: [idinvalidation = 70, idsite = 1, period = day(2020-02-01 - 2020-02-01), name = done49a9440bd6dba4b8850035e09d043c67] -No usable archive exists (ts_archived of existing = , now = 2020-02-03 04:05:06). -Found invalidated archive we can skip (no visits): [idinvalidation = 40, idsite = 1, period = day(2020-02-01 - 2020-02-01), name = donee0512c03f7c20af6ef96a8d792c6bb9f] -Skipping invalidated archive 71, segment 'actions>=4' is not in --force-idsegments: [idinvalidation = 71, idsite = 1, period = month(2020-02-01 - 2020-02-29), name = done49a9440bd6dba4b8850035e09d043c67] -No usable archive exists (ts_archived of existing = , now = 2020-02-03 04:05:06). -Found invalidated archive we can skip (no visits): [idinvalidation = 41, idsite = 1, period = month(2020-02-01 - 2020-02-29), name = donee0512c03f7c20af6ef96a8d792c6bb9f] -Skipping invalidated archive 66, segment 'actions>=4' is not in --force-idsegments: [idinvalidation = 66, idsite = 1, period = week(2020-01-27 - 2020-02-02), name = done49a9440bd6dba4b8850035e09d043c67] -No usable archive exists (ts_archived of existing = , now = 2020-02-03 04:05:06). -Found invalidated archive we can skip (no visits): [idinvalidation = 36, idsite = 1, period = week(2020-01-27 - 2020-02-02), name = donee0512c03f7c20af6ef96a8d792c6bb9f] -Skipping invalidated archive 63, segment 'actions>=4' is not in --force-idsegments: [idinvalidation = 63, idsite = 1, period = day(2020-01-01 - 2020-01-01), name = done49a9440bd6dba4b8850035e09d043c67] -No usable archive exists (ts_archived of existing = , now = 2020-02-03 04:05:06). -Found invalidated archive we can skip (no visits): [idinvalidation = 33, idsite = 1, period = day(2020-01-01 - 2020-01-01), name = donee0512c03f7c20af6ef96a8d792c6bb9f] -Skipping invalidated archive 64, segment 'actions>=4' is not in --force-idsegments: [idinvalidation = 64, idsite = 1, period = month(2020-01-01 - 2020-01-31), name = done49a9440bd6dba4b8850035e09d043c67] -No usable archive exists (ts_archived of existing = , now = 2020-02-03 04:05:06). -Found invalidated archive we can skip (no visits): [idinvalidation = 34, idsite = 1, period = month(2020-01-01 - 2020-01-31), name = donee0512c03f7c20af6ef96a8d792c6bb9f] -Skipping invalidated archive 65, segment 'actions>=4' is not in --force-idsegments: [idinvalidation = 65, idsite = 1, period = year(2020-01-01 - 2020-12-31), name = done49a9440bd6dba4b8850035e09d043c67] -No usable archive exists (ts_archived of existing = , now = 2020-02-03 04:05:06). -Found invalidated archive we can skip (no visits): [idinvalidation = 35, idsite = 1, period = year(2020-01-01 - 2020-12-31), name = donee0512c03f7c20af6ef96a8d792c6bb9f] -Skipping invalidated archive 58, segment 'actions>=4' is not in --force-idsegments: [idinvalidation = 58, idsite = 1, period = day(2019-12-31 - 2019-12-31), name = done49a9440bd6dba4b8850035e09d043c67] -No usable archive exists (ts_archived of existing = , now = 2020-02-03 04:05:06). -Found invalidated archive we can skip (no visits): [idinvalidation = 28, idsite = 1, period = day(2019-12-31 - 2019-12-31), name = donee0512c03f7c20af6ef96a8d792c6bb9f] -Skipping invalidated archive 56, segment 'actions>=4' is not in --force-idsegments: [idinvalidation = 56, idsite = 1, period = day(2019-12-30 - 2019-12-30), name = done49a9440bd6dba4b8850035e09d043c67] -No usable archive exists (ts_archived of existing = , now = 2020-02-03 04:05:06). -Found invalidated archive we can skip (no visits): [idinvalidation = 26, idsite = 1, period = day(2019-12-30 - 2019-12-30), name = donee0512c03f7c20af6ef96a8d792c6bb9f] -Skipping invalidated archive 57, segment 'actions>=4' is not in --force-idsegments: [idinvalidation = 57, idsite = 1, period = week(2019-12-30 - 2020-01-05), name = done49a9440bd6dba4b8850035e09d043c67] -No usable archive exists (ts_archived of existing = , now = 2020-02-03 04:05:06). -Found invalidated archive we can skip (no visits): [idinvalidation = 27, idsite = 1, period = week(2019-12-30 - 2020-01-05), name = donee0512c03f7c20af6ef96a8d792c6bb9f] -Skipping invalidated archive 54, segment 'actions>=4' is not in --force-idsegments: [idinvalidation = 54, idsite = 1, period = day(2019-12-23 - 2019-12-23), name = done49a9440bd6dba4b8850035e09d043c67] -No usable archive exists (ts_archived of existing = , now = 2020-02-03 04:05:06). -Found invalidated archive we can skip (no visits): [idinvalidation = 24, idsite = 1, period = day(2019-12-23 - 2019-12-23), name = donee0512c03f7c20af6ef96a8d792c6bb9f] -Skipping invalidated archive 55, segment 'actions>=4' is not in --force-idsegments: [idinvalidation = 55, idsite = 1, period = week(2019-12-23 - 2019-12-29), name = done49a9440bd6dba4b8850035e09d043c67] -No usable archive exists (ts_archived of existing = , now = 2020-02-03 04:05:06). -Found invalidated archive we can skip (no visits): [idinvalidation = 25, idsite = 1, period = week(2019-12-23 - 2019-12-29), name = donee0512c03f7c20af6ef96a8d792c6bb9f] -Skipping invalidated archive 52, segment 'actions>=4' is not in --force-idsegments: [idinvalidation = 52, idsite = 1, period = day(2019-12-16 - 2019-12-16), name = done49a9440bd6dba4b8850035e09d043c67] -No usable archive exists (ts_archived of existing = , now = 2020-02-03 04:05:06). -Found invalidated archive we can skip (no visits): [idinvalidation = 22, idsite = 1, period = day(2019-12-16 - 2019-12-16), name = donee0512c03f7c20af6ef96a8d792c6bb9f] -Skipping invalidated archive 53, segment 'actions>=4' is not in --force-idsegments: [idinvalidation = 53, idsite = 1, period = week(2019-12-16 - 2019-12-22), name = done49a9440bd6dba4b8850035e09d043c67] -No usable archive exists (ts_archived of existing = , now = 2020-02-03 04:05:06). -Found invalidated archive we can skip (no visits): [idinvalidation = 23, idsite = 1, period = week(2019-12-16 - 2019-12-22), name = donee0512c03f7c20af6ef96a8d792c6bb9f] -Skipping invalidated archive 1, segment '' is not in --force-idsegments: [idinvalidation = 1, idsite = 1, period = day(2019-12-12 - 2019-12-12), name = done] -Skipping invalidated archive 5, segment '' is not in --force-idsegments: [idinvalidation = 5, idsite = 1, period = day(2019-12-11 - 2019-12-11), name = done] -Skipping invalidated archive 9, segment '' is not in --force-idsegments: [idinvalidation = 9, idsite = 1, period = day(2019-12-10 - 2019-12-10), name = done] -Skipping invalidated archive 50, segment 'actions>=4' is not in --force-idsegments: [idinvalidation = 50, idsite = 1, period = day(2019-12-09 - 2019-12-09), name = done49a9440bd6dba4b8850035e09d043c67] -No usable archive exists (ts_archived of existing = , now = 2020-02-03 04:05:06). -Found invalidated archive we can skip (no visits): [idinvalidation = 20, idsite = 1, period = day(2019-12-09 - 2019-12-09), name = donee0512c03f7c20af6ef96a8d792c6bb9f] -Skipping invalidated archive 10, segment '' is not in --force-idsegments: [idinvalidation = 10, idsite = 1, period = week(2019-12-09 - 2019-12-15), name = done] -Skipping invalidated archive 6, segment '' is not in --force-idsegments: [idinvalidation = 6, idsite = 1, period = week(2019-12-09 - 2019-12-15), name = done] -Skipping invalidated archive 2, segment '' is not in --force-idsegments: [idinvalidation = 2, idsite = 1, period = week(2019-12-09 - 2019-12-15), name = done] -Skipping invalidated archive 51, segment 'actions>=4' is not in --force-idsegments: [idinvalidation = 51, idsite = 1, period = week(2019-12-09 - 2019-12-15), name = done49a9440bd6dba4b8850035e09d043c67] -No usable archive exists (ts_archived of existing = , now = 2020-02-03 04:05:06). -Processing invalidation: [idinvalidation = 21, idsite = 1, period = week(2019-12-09 - 2019-12-15), name = donee0512c03f7c20af6ef96a8d792c6bb9f]. -Skipping invalidated archive 13, segment '' is not in --force-idsegments: [idinvalidation = 13, idsite = 1, period = day(2019-12-02 - 2019-12-02), name = done] -Skipping invalidated archive 47, segment 'actions>=4' is not in --force-idsegments: [idinvalidation = 47, idsite = 1, period = day(2019-12-02 - 2019-12-02), name = done49a9440bd6dba4b8850035e09d043c67] -No usable archive exists (ts_archived of existing = , now = 2020-02-03 04:05:06). -Processing invalidation: [idinvalidation = 17, idsite = 1, period = day(2019-12-02 - 2019-12-02), name = donee0512c03f7c20af6ef96a8d792c6bb9f]. -Found archive with intersecting period with others in concurrent batch, skipping until next batch: [idinvalidation = 14, idsite = 1, period = week(2019-12-02 - 2019-12-08), name = done] -Found archive with intersecting period with others in concurrent batch, skipping until next batch: [idinvalidation = 48, idsite = 1, period = week(2019-12-02 - 2019-12-08), name = done49a9440bd6dba4b8850035e09d043c67] -Found archive with intersecting period with others in concurrent batch, skipping until next batch: [idinvalidation = 18, idsite = 1, period = week(2019-12-02 - 2019-12-08), name = donee0512c03f7c20af6ef96a8d792c6bb9f] -Found archive with intersecting period with others in concurrent batch, skipping until next batch: [idinvalidation = 15, idsite = 1, period = month(2019-12-01 - 2019-12-31), name = done] -Found archive with intersecting period with others in concurrent batch, skipping until next batch: [idinvalidation = 11, idsite = 1, period = month(2019-12-01 - 2019-12-31), name = done] -Found archive with intersecting period with others in concurrent batch, skipping until next batch: [idinvalidation = 7, idsite = 1, period = month(2019-12-01 - 2019-12-31), name = done] -Found archive with intersecting period with others in concurrent batch, skipping until next batch: [idinvalidation = 3, idsite = 1, period = month(2019-12-01 - 2019-12-31), name = done] -Found archive with intersecting period with others in concurrent batch, skipping until next batch: [idinvalidation = 49, idsite = 1, period = month(2019-12-01 - 2019-12-31), name = done49a9440bd6dba4b8850035e09d043c67] -Found archive with intersecting period with others in concurrent batch, skipping until next batch: [idinvalidation = 19, idsite = 1, period = month(2019-12-01 - 2019-12-31), name = donee0512c03f7c20af6ef96a8d792c6bb9f] -Found archive with intersecting period with others in concurrent batch, skipping until next batch: [idinvalidation = 16, idsite = 1, period = year(2019-01-01 - 2019-12-31), name = done] -Found archive with intersecting period with others in concurrent batch, skipping until next batch: [idinvalidation = 12, idsite = 1, period = year(2019-01-01 - 2019-12-31), name = done] -Found archive with intersecting period with others in concurrent batch, skipping until next batch: [idinvalidation = 8, idsite = 1, period = year(2019-01-01 - 2019-12-31), name = done] -Found archive with intersecting period with others in concurrent batch, skipping until next batch: [idinvalidation = 4, idsite = 1, period = year(2019-01-01 - 2019-12-31), name = done] -Found archive with intersecting period with others in concurrent batch, skipping until next batch: [idinvalidation = 62, idsite = 1, period = year(2019-01-01 - 2019-12-31), name = done49a9440bd6dba4b8850035e09d043c67] -Found archive with intersecting period with others in concurrent batch, skipping until next batch: [idinvalidation = 32, idsite = 1, period = year(2019-01-01 - 2019-12-31), name = donee0512c03f7c20af6ef96a8d792c6bb9f] +Found invalidated archive we can skip (no visits): [idinvalidation = 75, idsite = 1, period = day(2020-02-03 - 2020-02-03), name = donee0512c03f7c20af6ef96a8d792c6bb9f] +Found invalidated archive we can skip (no visits): [idinvalidation = 76, idsite = 1, period = week(2020-02-03 - 2020-02-09), name = donee0512c03f7c20af6ef96a8d792c6bb9f] +Found invalidated archive we can skip (no visits): [idinvalidation = 74, idsite = 1, period = day(2020-02-02 - 2020-02-02), name = donee0512c03f7c20af6ef96a8d792c6bb9f] +Found invalidated archive we can skip (no visits): [idinvalidation = 72, idsite = 1, period = day(2020-02-01 - 2020-02-01), name = donee0512c03f7c20af6ef96a8d792c6bb9f] +Found invalidated archive we can skip (no visits): [idinvalidation = 73, idsite = 1, period = month(2020-02-01 - 2020-02-29), name = donee0512c03f7c20af6ef96a8d792c6bb9f] +Found invalidated archive we can skip (no visits): [idinvalidation = 68, idsite = 1, period = week(2020-01-27 - 2020-02-02), name = donee0512c03f7c20af6ef96a8d792c6bb9f] +Found invalidated archive we can skip (no visits): [idinvalidation = 65, idsite = 1, period = day(2020-01-01 - 2020-01-01), name = donee0512c03f7c20af6ef96a8d792c6bb9f] +Found invalidated archive we can skip (no visits): [idinvalidation = 66, idsite = 1, period = month(2020-01-01 - 2020-01-31), name = donee0512c03f7c20af6ef96a8d792c6bb9f] +Found invalidated archive we can skip (no visits): [idinvalidation = 67, idsite = 1, period = year(2020-01-01 - 2020-12-31), name = donee0512c03f7c20af6ef96a8d792c6bb9f] +Found invalidated archive we can skip (no visits): [idinvalidation = 60, idsite = 1, period = day(2019-12-31 - 2019-12-31), name = donee0512c03f7c20af6ef96a8d792c6bb9f] +Found invalidated archive we can skip (no visits): [idinvalidation = 58, idsite = 1, period = day(2019-12-30 - 2019-12-30), name = donee0512c03f7c20af6ef96a8d792c6bb9f] +Found invalidated archive we can skip (no visits): [idinvalidation = 59, idsite = 1, period = week(2019-12-30 - 2020-01-05), name = donee0512c03f7c20af6ef96a8d792c6bb9f] +Found invalidated archive we can skip (no visits): [idinvalidation = 56, idsite = 1, period = day(2019-12-23 - 2019-12-23), name = donee0512c03f7c20af6ef96a8d792c6bb9f] +Found invalidated archive we can skip (no visits): [idinvalidation = 57, idsite = 1, period = week(2019-12-23 - 2019-12-29), name = donee0512c03f7c20af6ef96a8d792c6bb9f] +Found invalidated archive we can skip (no visits): [idinvalidation = 54, idsite = 1, period = day(2019-12-16 - 2019-12-16), name = donee0512c03f7c20af6ef96a8d792c6bb9f] +Found invalidated archive we can skip (no visits): [idinvalidation = 55, idsite = 1, period = week(2019-12-16 - 2019-12-22), name = donee0512c03f7c20af6ef96a8d792c6bb9f] +Processing invalidation: [idinvalidation = 5, idsite = 1, period = day(2019-12-12 - 2019-12-12), name = donee0512c03f7c20af6ef96a8d792c6bb9f]. +Processing invalidation: [idinvalidation = 17, idsite = 1, period = day(2019-12-11 - 2019-12-11), name = donee0512c03f7c20af6ef96a8d792c6bb9f]. +Processing invalidation: [idinvalidation = 29, idsite = 1, period = day(2019-12-10 - 2019-12-10), name = donee0512c03f7c20af6ef96a8d792c6bb9f]. +Starting archiving for ?module=API&method=CoreAdminHome.archiveReports&idSite=1&period=day&date=2019-12-12&format=json&segment=actions%3E%3D2&trigger=archivephp +Starting archiving for ?module=API&method=CoreAdminHome.archiveReports&idSite=1&period=day&date=2019-12-11&format=json&segment=actions%3E%3D2&trigger=archivephp +Starting archiving for ?module=API&method=CoreAdminHome.archiveReports&idSite=1&period=day&date=2019-12-10&format=json&segment=actions%3E%3D2&trigger=archivephp +Archived website id 1, period = day, date = 2019-12-12, segment = 'actions%3E%3D2', 0 visits found. Time elapsed: %fs +Archived website id 1, period = day, date = 2019-12-11, segment = 'actions%3E%3D2', 0 visits found. Time elapsed: %fs +Archived website id 1, period = day, date = 2019-12-10, segment = 'actions%3E%3D2', 0 visits found. Time elapsed: %fs +Found invalidated archive we can skip (no visits): [idinvalidation = 52, idsite = 1, period = day(2019-12-09 - 2019-12-09), name = donee0512c03f7c20af6ef96a8d792c6bb9f] +Processing invalidation: [idinvalidation = 53, idsite = 1, period = week(2019-12-09 - 2019-12-15), name = donee0512c03f7c20af6ef96a8d792c6bb9f]. +Processing invalidation: [idinvalidation = 49, idsite = 1, period = day(2019-12-02 - 2019-12-02), name = donee0512c03f7c20af6ef96a8d792c6bb9f]. No next invalidated archive. Starting archiving for ?module=API&method=CoreAdminHome.archiveReports&idSite=1&period=week&date=2019-12-09&format=json&segment=actions%3E%3D2&trigger=archivephp Starting archiving for ?module=API&method=CoreAdminHome.archiveReports&idSite=1&period=day&date=2019-12-02&format=json&segment=actions%3E%3D2&trigger=archivephp Archived website id 1, period = week, date = 2019-12-09, segment = 'actions%3E%3D2', 0 visits found. Time elapsed: %fs Archived website id 1, period = day, date = 2019-12-02, segment = 'actions%3E%3D2', 0 visits found. Time elapsed: %fs -Skipping invalidated archive 14, segment '' is not in --force-idsegments: [idinvalidation = 14, idsite = 1, period = week(2019-12-02 - 2019-12-08), name = done] -Skipping invalidated archive 48, segment 'actions>=4' is not in --force-idsegments: [idinvalidation = 48, idsite = 1, period = week(2019-12-02 - 2019-12-08), name = done49a9440bd6dba4b8850035e09d043c67] -No usable archive exists (ts_archived of existing = , now = 2020-02-03 04:05:06). -Processing invalidation: [idinvalidation = 18, idsite = 1, period = week(2019-12-02 - 2019-12-08), name = donee0512c03f7c20af6ef96a8d792c6bb9f]. -Found archive with intersecting period with others in concurrent batch, skipping until next batch: [idinvalidation = 15, idsite = 1, period = month(2019-12-01 - 2019-12-31), name = done] -Found archive with intersecting period with others in concurrent batch, skipping until next batch: [idinvalidation = 11, idsite = 1, period = month(2019-12-01 - 2019-12-31), name = done] -Found archive with intersecting period with others in concurrent batch, skipping until next batch: [idinvalidation = 7, idsite = 1, period = month(2019-12-01 - 2019-12-31), name = done] -Found archive with intersecting period with others in concurrent batch, skipping until next batch: [idinvalidation = 3, idsite = 1, period = month(2019-12-01 - 2019-12-31), name = done] -Found archive with intersecting period with others in concurrent batch, skipping until next batch: [idinvalidation = 49, idsite = 1, period = month(2019-12-01 - 2019-12-31), name = done49a9440bd6dba4b8850035e09d043c67] -Found archive with intersecting period with others in concurrent batch, skipping until next batch: [idinvalidation = 19, idsite = 1, period = month(2019-12-01 - 2019-12-31), name = donee0512c03f7c20af6ef96a8d792c6bb9f] -Found archive with intersecting period with others in concurrent batch, skipping until next batch: [idinvalidation = 16, idsite = 1, period = year(2019-01-01 - 2019-12-31), name = done] -Found archive with intersecting period with others in concurrent batch, skipping until next batch: [idinvalidation = 12, idsite = 1, period = year(2019-01-01 - 2019-12-31), name = done] -Found archive with intersecting period with others in concurrent batch, skipping until next batch: [idinvalidation = 8, idsite = 1, period = year(2019-01-01 - 2019-12-31), name = done] -Found archive with intersecting period with others in concurrent batch, skipping until next batch: [idinvalidation = 4, idsite = 1, period = year(2019-01-01 - 2019-12-31), name = done] -Found archive with intersecting period with others in concurrent batch, skipping until next batch: [idinvalidation = 62, idsite = 1, period = year(2019-01-01 - 2019-12-31), name = done49a9440bd6dba4b8850035e09d043c67] -Found archive with intersecting period with others in concurrent batch, skipping until next batch: [idinvalidation = 32, idsite = 1, period = year(2019-01-01 - 2019-12-31), name = donee0512c03f7c20af6ef96a8d792c6bb9f] +Processing invalidation: [idinvalidation = 50, idsite = 1, period = week(2019-12-02 - 2019-12-08), name = donee0512c03f7c20af6ef96a8d792c6bb9f]. No next invalidated archive. Starting archiving for ?module=API&method=CoreAdminHome.archiveReports&idSite=1&period=week&date=2019-12-02&format=json&segment=actions%3E%3D2&trigger=archivephp Archived website id 1, period = week, date = 2019-12-02, segment = 'actions%3E%3D2', 0 visits found. Time elapsed: %fs -Skipping invalidated archive 15, segment '' is not in --force-idsegments: [idinvalidation = 15, idsite = 1, period = month(2019-12-01 - 2019-12-31), name = done] -Skipping invalidated archive 11, segment '' is not in --force-idsegments: [idinvalidation = 11, idsite = 1, period = month(2019-12-01 - 2019-12-31), name = done] -Skipping invalidated archive 7, segment '' is not in --force-idsegments: [idinvalidation = 7, idsite = 1, period = month(2019-12-01 - 2019-12-31), name = done] -Skipping invalidated archive 3, segment '' is not in --force-idsegments: [idinvalidation = 3, idsite = 1, period = month(2019-12-01 - 2019-12-31), name = done] -Skipping invalidated archive 49, segment 'actions>=4' is not in --force-idsegments: [idinvalidation = 49, idsite = 1, period = month(2019-12-01 - 2019-12-31), name = done49a9440bd6dba4b8850035e09d043c67] -No usable archive exists (ts_archived of existing = , now = 2020-02-03 04:05:06). -Processing invalidation: [idinvalidation = 19, idsite = 1, period = month(2019-12-01 - 2019-12-31), name = donee0512c03f7c20af6ef96a8d792c6bb9f]. -Found archive with intersecting period with others in concurrent batch, skipping until next batch: [idinvalidation = 16, idsite = 1, period = year(2019-01-01 - 2019-12-31), name = done] -Found archive with intersecting period with others in concurrent batch, skipping until next batch: [idinvalidation = 12, idsite = 1, period = year(2019-01-01 - 2019-12-31), name = done] -Found archive with intersecting period with others in concurrent batch, skipping until next batch: [idinvalidation = 8, idsite = 1, period = year(2019-01-01 - 2019-12-31), name = done] -Found archive with intersecting period with others in concurrent batch, skipping until next batch: [idinvalidation = 4, idsite = 1, period = year(2019-01-01 - 2019-12-31), name = done] -Found archive with intersecting period with others in concurrent batch, skipping until next batch: [idinvalidation = 62, idsite = 1, period = year(2019-01-01 - 2019-12-31), name = done49a9440bd6dba4b8850035e09d043c67] -Found archive with intersecting period with others in concurrent batch, skipping until next batch: [idinvalidation = 32, idsite = 1, period = year(2019-01-01 - 2019-12-31), name = donee0512c03f7c20af6ef96a8d792c6bb9f] +Processing invalidation: [idinvalidation = 51, idsite = 1, period = month(2019-12-01 - 2019-12-31), name = donee0512c03f7c20af6ef96a8d792c6bb9f]. No next invalidated archive. Starting archiving for ?module=API&method=CoreAdminHome.archiveReports&idSite=1&period=month&date=2019-12-01&format=json&segment=actions%3E%3D2&trigger=archivephp Archived website id 1, period = month, date = 2019-12-01, segment = 'actions%3E%3D2', 0 visits found. Time elapsed: %fs -Skipping invalidated archive 16, segment '' is not in --force-idsegments: [idinvalidation = 16, idsite = 1, period = year(2019-01-01 - 2019-12-31), name = done] -Skipping invalidated archive 12, segment '' is not in --force-idsegments: [idinvalidation = 12, idsite = 1, period = year(2019-01-01 - 2019-12-31), name = done] -Skipping invalidated archive 8, segment '' is not in --force-idsegments: [idinvalidation = 8, idsite = 1, period = year(2019-01-01 - 2019-12-31), name = done] -Skipping invalidated archive 4, segment '' is not in --force-idsegments: [idinvalidation = 4, idsite = 1, period = year(2019-01-01 - 2019-12-31), name = done] -Skipping invalidated archive 62, segment 'actions>=4' is not in --force-idsegments: [idinvalidation = 62, idsite = 1, period = year(2019-01-01 - 2019-12-31), name = done49a9440bd6dba4b8850035e09d043c67] -No usable archive exists (ts_archived of existing = , now = 2020-02-03 04:05:06). -Processing invalidation: [idinvalidation = 32, idsite = 1, period = year(2019-01-01 - 2019-12-31), name = donee0512c03f7c20af6ef96a8d792c6bb9f]. +Processing invalidation: [idinvalidation = 64, idsite = 1, period = year(2019-01-01 - 2019-12-31), name = donee0512c03f7c20af6ef96a8d792c6bb9f]. No next invalidated archive. Starting archiving for ?module=API&method=CoreAdminHome.archiveReports&idSite=1&period=year&date=2019-01-01&format=json&segment=actions%3E%3D2&trigger=archivephp Archived website id 1, period = year, date = 2019-01-01, segment = 'actions%3E%3D2', 0 visits found. Time elapsed: %fs No next invalidated archive. -Finished archiving for site 1, 5 API requests, Time elapsed: %fs [1 / 1 done] +Finished archiving for site 1, 8 API requests, Time elapsed: %fs [1 / 1 done] No more sites left to archive, stopping. Done archiving! --------------------------- SUMMARY -Processed 5 archives. -Total API requests: 5 -done: 5 req, %d ms, no error +Processed 8 archives. +Total API requests: 8 +done: 8 req, %d ms, no error Time elapsed: %fs LOG; - $this->assertStringMatchesFormat($expected, $logger->output); + // remove a bunch of debug lines since we can't have a sprintf format that long + $output = $this->cleanOutput($logger->output); + + $this->assertStringMatchesFormat($expected, $output); + } + + private function cleanOutput($output) + { + $output = explode("\n", $output); + $output = array_filter($output, function ($l) { return strpos($l, 'Skipping invalidated archive') === false; }); + $output = array_filter($output, function ($l) { return strpos($l, 'Found archive with intersecting period') === false; }); + $output = array_filter($output, function ($l) { return strpos($l, 'Found duplicate invalidated archive') === false; }); + $output = array_filter($output, function ($l) { return strpos($l, 'No usable archive exists') === false; }); + $output = implode("\n", $output); + return $output; } public function test_shouldNotStopProcessingWhenOneSiteIsInvalid() |