diff --git a/core/CronArchive.php b/core/CronArchive.php index ba0b1632203843223ce342a8f305b505b890ffd8..abacfb242f5395df2fda04669b50a796432882e0 100644 --- a/core/CronArchive.php +++ b/core/CronArchive.php @@ -730,7 +730,8 @@ class CronArchive && !$shouldArchivePeriods && $this->shouldArchiveAllSites ) { - $this->logger->info("Skipped website id $idSite, no visits in the last " . $date . " days, " . $timerWebsite->__toString()); + $humanReadableDate = $this->formatReadableDateRange($date); + $this->logger->info("Skipped website id $idSite, no visits in the $humanReadableDate days, " . $timerWebsite->__toString()); $this->skipped++; return false; } @@ -751,6 +752,19 @@ class CronArchive return $segments; } + private function formatReadableDateRange($date) + { + if (0 === strpos($date, 'last')) { + $readable = 'last ' . str_replace('last', '', $date); + } elseif (0 === strpos($date, 'previous')) { + $readable = 'previous ' . str_replace('previous', '', $date); + } else { + $readable = 'last ' . $date; + } + + return $readable; + } + /** * Will trigger API requests for the specified Website $idSite, * for the specified $period, for all segments that are pre-processed for this website. @@ -1242,7 +1256,8 @@ class CronArchive private function logArchivedWebsite($idSite, $period, $date, $segmentsCount, $visitsInLastPeriods, $visitsToday, Timer $timer) { if (strpos($date, 'last') === 0 || strpos($date, 'previous') === 0) { - $visitsInLastPeriods = (int)$visitsInLastPeriods . " visits in last " . $date . " " . $period . "s, "; + $humanReadable = $this->formatReadableDateRange($date); + $visitsInLastPeriods = (int)$visitsInLastPeriods . " visits in $humanReadable " . $period . "s, "; $thisPeriod = $period == "day" ? "today" : "this " . $period; $visitsInLastPeriod = (int)$visitsToday . " visits " . $thisPeriod . ", "; } else {