diff options
author | Zoltan Flamis <zoltan@innocraft.com> | 2021-05-07 05:03:03 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-07 05:03:03 +0300 |
commit | 1fcc10569378263775a1f8a3e2429406da9423ce (patch) | |
tree | aa80450b3bc334e420baf3239cfcb674c0cae9d3 /core/CronArchive.php | |
parent | 39361b179efc476a81e391b886e0b3913b994499 (diff) |
Make archiving process to respect process_new_segments_from settings (#17351)
* update canSkipThisArchive in Loader
* Update Loader.php
* Update Loader.php
* make cronarchive respect segment creation
* check for null
* do not use force-date-last-n in test
* fix some other tests
* fix other test
* add deprecated message
* Update UITestFixture.php
* wip
* reafactor and add tests
* take into account requested report
* refactor if
* refactoring
* fix bug
Co-authored-by: Thomas Steur <tsteur@users.noreply.github.com>
Diffstat (limited to 'core/CronArchive.php')
-rw-r--r-- | core/CronArchive.php | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/core/CronArchive.php b/core/CronArchive.php index 85419be50f..ec52fe9a31 100644 --- a/core/CronArchive.php +++ b/core/CronArchive.php @@ -894,6 +894,23 @@ class CronArchive if ($this->canWeSkipInvalidatingBecauseThereIsAUsablePeriod($params, $doNotIncludeTtlInExistingArchiveCheck)) { $this->logger->debug(' Found usable archive for {archive}, skipping invalidation.', ['archive' => $params]); } else { + if (empty($this->segmentArchiving)) { + // might not be initialised if init is not called + $this->segmentArchiving = StaticContainer::get(SegmentArchiving::class); + } + + $segmentInfo = $this->segmentArchiving->findSegmentForHash($params->getSegment()->getHash(), $idSite); + + if ($segmentInfo) { + $segmentArchiveStartDate = $this->segmentArchiving->getReArchiveSegmentStartDate($segmentInfo); + + if ($segmentArchiveStartDate !== null && $segmentArchiveStartDate->isLater($params->getPeriod()->getDateEnd()->getEndOfDay())) { + // the system is not allowed to invalidate reports for this period + // automatically, only a user can specifically invalidate + continue; + } + } + $this->getApiToInvalidateArchivedReport()->invalidateArchivedReports($idSite, $date, $period, $segmentDefinition, $cascadeDown = false, $_forceInvalidateNonexistant); } |