Skip to content

Commit

Permalink
Refs matomo-org#4903 Fix regression + tweaks to debug message
Browse files Browse the repository at this point in the history
(thanks phpstorm for telling me the variable was unused)
  • Loading branch information
mattab committed Apr 2, 2014
1 parent 9d330e8 commit 47cd0bb
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions core/CronArchive.php
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ private function archiveSingleSite($idsite, $requestsBefore)
}

if ($skipDayArchive) {
$this->log("Skipped website id $idsite, already processed today's report in recent run, "
$this->log("Skipped website id $idsite, already done "
. \Piwik\MetricsFormatter::getPrettyTimeFromSeconds($elapsedSinceLastArchiving, true, $isHtml = false)
. " ago, " . $timerWebsite->__toString());
$this->skippedDayArchivesWebsites++;
Expand Down Expand Up @@ -389,13 +389,12 @@ private function archiveSingleSite($idsite, $requestsBefore)


$timer = new Timer;
$dateLast = $this->getApiDateLastParameter($idsite, "day");
$dateLast = $this->getApiDateLastParameter($idsite, "day", $processDaysSince);
$url = $this->getVisitsRequestUrl($idsite, "day", $dateLast);
$content = $this->request($url);
$response = @unserialize($content);
$visitsToday = $this->getVisitsLastPeriodFromApiResponse($response);
$visitsLastDays = $this->getVisitsFromApiResponse($response);
$this->logArchivedWebsite($idsite, "day", $dateLast, $visitsLastDays, $visitsToday, $timer);

if (empty($content)
|| !is_array($response)
Expand Down Expand Up @@ -434,9 +433,10 @@ private function archiveSingleSite($idsite, $requestsBefore)
$this->visitsToday += $visitsToday;
$this->websitesWithVisitsSinceLastRun++;
$this->archiveVisitsAndSegments($idsite, "day", $lastTimestampWebsiteProcessedDay);
$this->logArchivedWebsite($idsite, "day", $dateLast, $visitsLastDays, $visitsToday, $timer);

if (!$shouldArchivePeriods) {
$this->log("Skipped website id $idsite, already processed period reports in recent run, "
$this->log("Skipped website id $idsite periods processing, already done "
. \Piwik\MetricsFormatter::getPrettyTimeFromSeconds($elapsedSinceLastArchiving, true, $isHtml = false)
. " ago, " . $timerWebsite->__toString());
$this->skippedDayArchivesWebsites++;
Expand Down Expand Up @@ -1181,9 +1181,10 @@ private function getApiDateLastParameter($idsite, $period, $lastTimestampWebsite
*/
private function logArchivedWebsite($idsite, $period, $dateLast, $visitsInLastPeriods, $visitsToday, Timer $timer)
{
$thisPeriod = $period == "day" ? "today" : "this " . $period;
$this->log("Archived website id = $idsite, period = $period, "
. (int)$visitsInLastPeriods . " visits in last " . $dateLast . " " . $period . "s, "
. (int)$visitsToday . " visits this " . $period . ", "
. (int)$visitsToday . " visits " . $thisPeriod . ", "
. $timer->__toString());
}
}
Expand Down

0 comments on commit 47cd0bb

Please sign in to comment.