diff options
author | diosmosis <benaka@piwik.pro> | 2015-03-10 09:26:02 +0300 |
---|---|---|
committer | diosmosis <benaka@piwik.pro> | 2015-03-10 09:26:02 +0300 |
commit | 5197b1cd4ddd21e7c2ab4cfe2906dff92ac35734 (patch) | |
tree | 13ff38acb323c52e444fc5691a4e3bdad1e55bd2 /plugins/CoreAdminHome/Tasks.php | |
parent | b828d5f6b40e5a182a6e18db04f740fd309af758 (diff) |
In purging scheduled task, only purge once per year-month combination found, not once per archive table since dates can appear twice (once for numeric table & once for blob table).
Diffstat (limited to 'plugins/CoreAdminHome/Tasks.php')
-rw-r--r-- | plugins/CoreAdminHome/Tasks.php | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/plugins/CoreAdminHome/Tasks.php b/plugins/CoreAdminHome/Tasks.php index b6856f5ef8..df2bb2b3b0 100644 --- a/plugins/CoreAdminHome/Tasks.php +++ b/plugins/CoreAdminHome/Tasks.php @@ -59,17 +59,24 @@ class Tasks extends \Piwik\Plugin\Tasks Log::info("Purging archives in {tableCount} archive tables.", array('tableCount' => count($archiveTables))); - // TODO: won't this execute purges twice, since this includes blobs + numeric tables, but purging should be called w/ just the date? + // keep track of dates we purge for, since getTablesArchivesInstalled() will return numeric & blob + // tables (so dates will appear two times, and we should only purge once per date) + $datesPurged = array(); + foreach ($archiveTables as $table) { $date = ArchiveTableCreator::getDateFromTableName($table); list($year, $month) = explode('_', $date); // Somehow we may have archive tables created with older dates, prevent exception from being thrown - if ($year > 1990) { + if ($year > 1990 + && empty($datesPurged[$date]) + ) { $dateObj = Date::factory("$year-$month-15"); $this->archivePurger->purgeOutdatedArchives($dateObj); $this->archivePurger->purgeArchivesWithPeriodRange($dateObj); + + $datesPurged[$date] = true; } } } |