diff options
author | Peter Zhang <peter@innocraft.com> | 2021-10-08 03:50:21 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-08 03:50:21 +0300 |
commit | b9ba1e58d076708ccab251428b6d4d7a12ab3dc2 (patch) | |
tree | ddf32d387e169f4b4a8d548e0bc1074cda418c5f /plugins/CoreAdminHome | |
parent | 41b79fe4dbd179338df22c90f2a44aa7c63b4183 (diff) |
scheduled tasks should not launch archiving when browser archiving is disabled (#18101)
Diffstat (limited to 'plugins/CoreAdminHome')
-rw-r--r-- | plugins/CoreAdminHome/Tasks.php | 2 | ||||
-rw-r--r-- | plugins/CoreAdminHome/tests/Integration/TasksTest.php | 6 |
2 files changed, 3 insertions, 5 deletions
diff --git a/plugins/CoreAdminHome/Tasks.php b/plugins/CoreAdminHome/Tasks.php index 0adfb63973..803880b621 100644 --- a/plugins/CoreAdminHome/Tasks.php +++ b/plugins/CoreAdminHome/Tasks.php @@ -233,7 +233,7 @@ class Tasks extends \Piwik\Plugin\Tasks */ public function purgeOutdatedArchives() { - if ($this->willPurgingCausePotentialProblemInUI()) { + if ($this->willPurgingCausePotentialProblemInUI() && !Rules::$disablePureOutdatedArchive) { $this->logger->info("Purging temporary archives: skipped (browser triggered archiving not enabled & not running after core:archive)"); return false; } diff --git a/plugins/CoreAdminHome/tests/Integration/TasksTest.php b/plugins/CoreAdminHome/tests/Integration/TasksTest.php index 9edcbc5fcc..06765ef54d 100644 --- a/plugins/CoreAdminHome/tests/Integration/TasksTest.php +++ b/plugins/CoreAdminHome/tests/Integration/TasksTest.php @@ -79,7 +79,7 @@ class TasksTest extends IntegrationTestCase public function tearDown(): void { - unset($_GET['trigger']); + Rules::$disablePureOutdatedArchive = false; parent::tearDown(); } @@ -103,8 +103,6 @@ class TasksTest extends IntegrationTestCase public function test_purgeOutdatedArchives_SkipsPurging_WhenBrowserArchivingDisabled_AndCronArchiveTriggerNotPresent() { Rules::setBrowserTriggerArchiving(false); - unset($_GET['trigger']); - $wasPurged = $this->tasks->purgeOutdatedArchives(); $this->assertFalse($wasPurged); } @@ -112,7 +110,7 @@ class TasksTest extends IntegrationTestCase public function test_purgeOutdatedArchives_Purges_WhenBrowserArchivingEnabled_AndCronArchiveTriggerPresent() { Rules::setBrowserTriggerArchiving(false); - $_GET['trigger'] = 'archivephp'; + Rules::$disablePureOutdatedArchive = true; $wasPurged = $this->tasks->purgeOutdatedArchives(); $this->assertTrue($wasPurged); |