From a1fb019c795949faf5d1cb677f338842d6063ffc Mon Sep 17 00:00:00 2001 From: diosmosis Date: Sun, 1 Mar 2015 16:43:02 -0800 Subject: Refs #7181, remove isRequestAuthorizedToArchive call in Rules::shouldPurgeOutdatedArchives() so archive purging can be forced in contexts other than scheduled task running. --- plugins/CoreAdminHome/Tasks.php | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'plugins/CoreAdminHome/Tasks.php') 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); -- cgit v1.2.3