Skip to content
Extraits de code Groupes Projets
Valider 10c4a028 rédigé par Thomas Steur's avatar Thomas Steur
Parcourir les fichiers

refs #8621 fix Wrong "Time Elapsed" in core:archive output

parent 96ae06bd
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -730,7 +730,8 @@ class CronArchive ...@@ -730,7 +730,8 @@ class CronArchive
&& !$shouldArchivePeriods && !$shouldArchivePeriods
&& $this->shouldArchiveAllSites && $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++; $this->skipped++;
return false; return false;
} }
...@@ -751,6 +752,19 @@ class CronArchive ...@@ -751,6 +752,19 @@ class CronArchive
return $segments; 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, * Will trigger API requests for the specified Website $idSite,
* for the specified $period, for all segments that are pre-processed for this website. * for the specified $period, for all segments that are pre-processed for this website.
...@@ -1242,7 +1256,8 @@ class CronArchive ...@@ -1242,7 +1256,8 @@ class CronArchive
private function logArchivedWebsite($idSite, $period, $date, $segmentsCount, $visitsInLastPeriods, $visitsToday, Timer $timer) private function logArchivedWebsite($idSite, $period, $date, $segmentsCount, $visitsInLastPeriods, $visitsToday, Timer $timer)
{ {
if (strpos($date, 'last') === 0 || strpos($date, 'previous') === 0) { 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; $thisPeriod = $period == "day" ? "today" : "this " . $period;
$visitsInLastPeriod = (int)$visitsToday . " visits " . $thisPeriod . ", "; $visitsInLastPeriod = (int)$visitsToday . " visits " . $thisPeriod . ", ";
} else { } else {
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter