diff options
author | diosmosis <benaka@piwik.pro> | 2015-03-02 02:09:58 +0300 |
---|---|---|
committer | diosmosis <benaka@piwik.pro> | 2015-03-02 02:09:58 +0300 |
commit | 1cb376c5734457b5ee90805aa1102ae8c7be3d32 (patch) | |
tree | bb535e5c2d609ce481557c9bb7f97ef573683d7f /core/ArchiveProcessor/Rules.php | |
parent | d556d333e4fcfccfbe9298c778670f548bd56862 (diff) |
Refs #7181, change ArchivePurger to use instance methods instead of static methods, move Rules::shouldPurgeOutdatedArchives since it is only used by ArchivePurger and move comment in said function.
Diffstat (limited to 'core/ArchiveProcessor/Rules.php')
-rw-r--r-- | core/ArchiveProcessor/Rules.php | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/core/ArchiveProcessor/Rules.php b/core/ArchiveProcessor/Rules.php index 1e94a046db..7d4ac8e564 100644 --- a/core/ArchiveProcessor/Rules.php +++ b/core/ArchiveProcessor/Rules.php @@ -131,51 +131,6 @@ class Rules return $doneFlags; } - /** - * Returns false if we should not purge data for this month, - * or returns a timestamp indicating outdated archives older than this timestamp (processed before) can be purged. - * - * Note: when calling this function it is assumed that the callee will purge the outdated archives afterwards. - * - * @param \Piwik\Date $date - * @return int|bool Outdated archives older than this timestamp should be purged - */ - public static function shouldPurgeOutdatedArchives(Date $date) - { - if (! self::isRequestAuthorizedToArchive()){ - Log::info("Purging temporary archives: skipped (no authorization)"); - return false; - } - - $key = self::FLAG_TABLE_PURGED . "blob_" . $date->toString('Y_m'); - $timestamp = Option::get($key); - - // we shall purge temporary archives after their timeout is finished, plus an extra 6 hours - // in case archiving is disabled or run once a day, we give it this extra time to run - // and re-process more recent records... - $temporaryArchivingTimeout = self::getTodayArchiveTimeToLive(); - $hoursBetweenPurge = 6; - $purgeEveryNSeconds = max($temporaryArchivingTimeout, $hoursBetweenPurge * 3600); - - // we only delete archives if we are able to process them, otherwise, the browser might process reports - // when &segment= is specified (or custom date range) and would below, delete temporary archives that the - // browser is not able to process until next cron run (which could be more than 1 hour away) - if ($timestamp !== false && $timestamp >= time() - $purgeEveryNSeconds) { - Log::info("Purging temporary archives: skipped (purging every " . $hoursBetweenPurge . "hours)"); - return false; - } - - Option::set($key, time()); - - if (self::isBrowserTriggerEnabled()) { - // If Browser Archiving is enabled, it is likely there are many more temporary archives - // We delete more often which is safe, since reports are re-processed on demand - return Date::factory(time() - 2 * $temporaryArchivingTimeout)->getDateTime(); - } - - // If cron core:archive command is building the reports, we should keep all temporary reports from today - return Date::factory('yesterday')->getDateTime(); - } public static function getMinTimeProcessedForTemporaryArchive( Date $dateStart, \Piwik\Period $period, Segment $segment, Site $site) |