From 41ca1a79e702a3330299db6d6552b81ed77c4f23 Mon Sep 17 00:00:00 2001 From: diosmosis Date: Mon, 1 Feb 2021 17:33:54 -0800 Subject: Allow filtering for invalidations for specific reports in core:archive (mostly for automation purposes). (#16991) --- core/CronArchive/ArchiveFilter.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'core') diff --git a/core/CronArchive/ArchiveFilter.php b/core/CronArchive/ArchiveFilter.php index 7789ed556b..c3686aaa59 100644 --- a/core/CronArchive/ArchiveFilter.php +++ b/core/CronArchive/ArchiveFilter.php @@ -53,6 +53,13 @@ class ArchiveFilter */ private $skipSegmentsForToday = false; + /** + * If enabled, the only invalidations that will be processed are for the specific plugin and report specified + * here. Must be in the format "MyPlugin.myReport". + * @var string|null + */ + private $forceReport = null; + public function __construct() { $this->setRestrictToPeriods(''); @@ -102,6 +109,14 @@ class ArchiveFilter return "period is not specified in --force-periods"; } + if (!empty($this->forceReport) + && (empty($archive['plugin']) + || empty($archive['report']) + || $archive['plugin'] . '.' . $archive['report'] != $this->forceReport) + ) { + return "report is not the same as value specified in --force-report"; + } + return false; } @@ -224,6 +239,11 @@ class ArchiveFilter return $this->skipSegmentsForToday; } + public function setForceReport($forceReport) + { + $this->forceReport = $forceReport; + } + /** * @return array */ -- cgit v1.2.3