Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordiosmosis <benaka@piwik.pro>2015-03-02 03:43:02 +0300
committerdiosmosis <benaka@piwik.pro>2015-03-02 03:43:02 +0300
commita1fb019c795949faf5d1cb677f338842d6063ffc (patch)
tree285ea8c3932883eb42b2004cdb77d1a4935daf94 /plugins/CoreAdminHome/Tasks.php
parent707dc96a77a352671e916e01fed420c92920e5dc (diff)
Refs #7181, remove isRequestAuthorizedToArchive call in Rules::shouldPurgeOutdatedArchives() so archive purging can be forced in contexts other than scheduled task running.
Diffstat (limited to 'plugins/CoreAdminHome/Tasks.php')
-rw-r--r--plugins/CoreAdminHome/Tasks.php11
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);