diff options
Diffstat (limited to 'plugins/CoreAdminHome/Tasks.php')
-rw-r--r-- | plugins/CoreAdminHome/Tasks.php | 11 |
1 files changed, 11 insertions, 0 deletions
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); |