Skip to content

Commit

Permalink
Ensure to use correct date while archiving
Browse files Browse the repository at this point in the history
  • Loading branch information
sgiehl committed Mar 24, 2020
1 parent c9b3d5c commit 9969201
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions core/CronArchive.php
Expand Up @@ -23,7 +23,6 @@
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\SitesToReprocessDistributedList;
use Piwik\CronArchive\SegmentArchivingRequestUrlProvider;
Expand Down Expand Up @@ -978,10 +977,10 @@ protected function processArchiveDays($idSite, $lastTimestampWebsiteProcessedDay
public function isThereAValidArchiveForPeriod($idSite, $period, $date, $segment = '')
{
if (Range::isMultiplePeriod($date, $period)) {
$rangePeriod = Factory::build($period, $date, Site::getTimezoneFor($idSite));
$rangePeriod = PeriodFactory::build($period, $date, Site::getTimezoneFor($idSite));
$periodsToCheck = $rangePeriod->getSubperiods();
} else {
$periodsToCheck = [Factory::build($period, $date, Site::getTimezoneFor($idSite))];
$periodsToCheck = [PeriodFactory::build($period, $date, Site::getTimezoneFor($idSite))];
}

$isTodayIncluded = $this->isTodayIncludedInPeriod($idSite, $periodsToCheck);
Expand All @@ -991,7 +990,7 @@ public function isThereAValidArchiveForPeriod($idSite, $period, $date, $segment
if ($isTodayIncluded
&& !$isLast
) {
return [false, null];
return [false, $date];
}

$periodsToCheckRanges = array_map(function (Period $p) { return $p->getRangeString(); }, $periodsToCheck);
Expand Down

0 comments on commit 9969201

Please sign in to comment.