diff options
author | mattpiwik <matthieu.aubry@gmail.com> | 2012-02-16 08:31:02 +0400 |
---|---|---|
committer | mattpiwik <matthieu.aubry@gmail.com> | 2012-02-16 08:31:02 +0400 |
commit | 4cef8c0f9ca255b7cab08bd89895fb853f066fa8 (patch) | |
tree | f7129c0d131f7cda14f804c04b989237f5a7ef4e | |
parent | 9ca31760bd98e2ecea5ba7683f04c1f9a5a2502a (diff) |
Refs #23271.7
Fixing bug ensuring all periods are processed for low traffic websites
git-svn-id: http://dev.piwik.org/svn/trunk@5860 59fd770c-687e-43c8-a1e3-f5a4ff64c105
-rw-r--r-- | misc/cron/archive.php | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/misc/cron/archive.php b/misc/cron/archive.php index 371ed481e2..d8aa9f6310 100644 --- a/misc/cron/archive.php +++ b/misc/cron/archive.php @@ -69,6 +69,7 @@ class Archiving // By default, we only process the current week/month/year at most once an hour protected $processPeriodsMaximumEverySeconds = 3600; + protected $websiteDayHasFinishedSinceLastRun = array(); protected $piwikUrl = false; protected $token_auth = false; protected $visits = 0; @@ -202,6 +203,14 @@ class Archiving $shouldArchivePeriods = true; } + // If the website is archived because it is a new day in its timezone + // We make sure all periods are archived, even if there is 0 visit today + if(!$shouldArchivePeriods + && in_array($idsite, $this->websiteDayHasFinishedSinceLastRun)) + { + $shouldArchivePeriods = true; + } + // Test if we should process this website at all $elapsedSinceLastArchiving = time() - $lastTimestampWebsiteProcessedDay; if(!$shouldArchivePeriods @@ -675,10 +684,10 @@ class Archiving $websiteDayHasFinishedSinceLastRun = Piwik_SitesManager_API::getInstance()->getSitesIdFromTimezones($timezoneToProcess); $websiteDayHasFinishedSinceLastRun = array_diff($websiteDayHasFinishedSinceLastRun, $this->websites); $this->websiteDayHasFinishedSinceLastRun = $websiteDayHasFinishedSinceLastRun; - if(count($this->websiteDayHasFinishedSinceLastRun) > 0) + if(count($websiteDayHasFinishedSinceLastRun) > 0) { - $websiteIds = !empty($this->websiteDayHasFinishedSinceLastRun) ? ", IDs: ".implode(", ", $this->websiteDayHasFinishedSinceLastRun) : ""; - $this->log("Will process ". count($this->websiteDayHasFinishedSinceLastRun). " other websites because the last time they were archived was on a different day (in the website's timezone) " . $websiteIds); + $websiteIds = !empty($websiteDayHasFinishedSinceLastRun) ? ", IDs: ".implode(", ", $websiteDayHasFinishedSinceLastRun) : ""; + $this->log("Will process ". count($websiteDayHasFinishedSinceLastRun). " other websites because the last time they were archived was on a different day (in the website's timezone) " . $websiteIds); $this->websites = array_merge($this->websites, $websiteDayHasFinishedSinceLastRun); } |