diff options
author | diosmosis <diosmosis@users.noreply.github.com> | 2020-03-10 03:21:49 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-10 03:21:49 +0300 |
commit | 22cde646ec8247a068f75e673b69a51b97c825c2 (patch) | |
tree | 9625275ddbcc4b4252f3ab8dc42f449b3cf6bb3c /plugins/CoreAdminHome/Tasks.php | |
parent | d6df56cb86f74b4fd3406b2802945470449b4b0a (diff) |
Move Archive.php archive invalidation to Loader… (#15616)3.13.4-b1
* Move Archive.php archive invalidation to Loader so we only invalidate when about to launch archiving.
* Attempt to handle more cases when invalidating before launching archiving.
* fix possible sql error
* fix possible error
* fixing some tests
* remove test code
* Only invalidate specific archive being requested.
* Do not invalidate on today in tracker and avoid existing valid archive check in CronArchive.
* more test fixes
* Attempt to fix more tests.
* Fixing last tests.
* another test fix
* Invalidate in scheduled task if browser triggered archiving is enabled.
* deal with TODO
* Get ArchiveSelectorTest to pass.
* applying review feedback including new tests
* apply review feedback & fix tests
* fix couple more tests
Co-authored-by: Thomas Steur <tsteur@users.noreply.github.com>
Diffstat (limited to 'plugins/CoreAdminHome/Tasks.php')
-rw-r--r-- | plugins/CoreAdminHome/Tasks.php | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/plugins/CoreAdminHome/Tasks.php b/plugins/CoreAdminHome/Tasks.php index d94979c9c3..1e3933f972 100644 --- a/plugins/CoreAdminHome/Tasks.php +++ b/plugins/CoreAdminHome/Tasks.php @@ -9,11 +9,14 @@ namespace Piwik\Plugins\CoreAdminHome; use Piwik\API\Request; +use Piwik\Archive; +use Piwik\Archive\ArchiveInvalidator; use Piwik\ArchiveProcessor\Rules; use Piwik\Archive\ArchivePurger; use Piwik\Common; use Piwik\Config; use Piwik\Container\StaticContainer; +use Piwik\CronArchive; use Piwik\DataAccess\ArchiveTableCreator; use Piwik\Date; use Piwik\Db; @@ -60,6 +63,10 @@ class Tasks extends \Piwik\Plugin\Tasks public function schedule() { + // for browser triggered archiving, make sure we invalidate archives once a day just to make + // sure all archives that need to be invalidated get invalidated + $this->daily('invalidateOutdatedArchives', null, self::HIGH_PRIORITY); + // general data purge on older archive tables, executed daily $this->daily('purgeOutdatedArchives', null, self::HIGH_PRIORITY); @@ -81,6 +88,17 @@ class Tasks extends \Piwik\Plugin\Tasks $this->scheduleTrackingCodeReminderChecks(); } + public function invalidateOutdatedArchives() + { + if (!Rules::isBrowserTriggerEnabled()) { + $this->logger->info("Browser triggered archiving disabled, archives will be invalidated during core:archive."); + return; + } + + $cronArchive = new CronArchive(); + $cronArchive->invalidateArchivedReportsForSitesThatNeedToBeArchivedAgain(); + } + private function scheduleTrackingCodeReminderChecks() { $daysToTrackedVisitsCheck = (int) Config::getInstance()->General['num_days_before_tracking_code_reminder']; |