diff options
-rw-r--r-- | core/DataAccess/ArchivePurger.php | 8 | ||||
-rw-r--r-- | plugins/CoreAdminHome/Tasks.php | 11 |
2 files changed, 11 insertions, 8 deletions
diff --git a/core/DataAccess/ArchivePurger.php b/core/DataAccess/ArchivePurger.php index 623071c84a..cd8241b797 100644 --- a/core/DataAccess/ArchivePurger.php +++ b/core/DataAccess/ArchivePurger.php @@ -50,14 +50,6 @@ class ArchivePurger */ public static function shouldPurgeOutdatedArchives(Date $date) { - // 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 (!Rules::isRequestAuthorizedToArchive()) { - Log::info("Purging temporary archives: skipped (request not allowed to initiate archiving)"); - return false; - } - $temporaryArchivingTimeout = Rules::getTodayArchiveTimeToLive(); if (Rules::isBrowserTriggerEnabled()) { // If Browser Archiving is enabled, it is likely there are many more temporary archives diff --git a/plugins/CoreAdminHome/Tasks.php b/plugins/CoreAdminHome/Tasks.php index 8ee38a433a..9682b50283 100644 --- a/plugins/CoreAdminHome/Tasks.php +++ b/plugins/CoreAdminHome/Tasks.php @@ -8,10 +8,12 @@ */ namespace Piwik\Plugins\CoreAdminHome; +use Piwik\ArchiveProcessor\Rules; use Piwik\DataAccess\ArchivePurger; use Piwik\DataAccess\ArchiveTableCreator; use Piwik\Date; use Piwik\Db; +use Piwik\Log; class Tasks extends \Piwik\Plugin\Tasks { @@ -39,6 +41,15 @@ class Tasks extends \Piwik\Plugin\Tasks public function purgeOutdatedArchives() { + // TODO: is this correct? wouldn't segment archives create DONE archives, not DONE_TEMPORARY? should try to replicate in tests + // 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 (!Rules::isRequestAuthorizedToArchive()) { + Log::info("Purging temporary archives: skipped (request not allowed to initiate archiving)"); + return false; + } + $archiveTables = ArchiveTableCreator::getTablesArchivesInstalled(); foreach ($archiveTables as $table) { $date = ArchiveTableCreator::getDateFromTableName($table); |