diff options
author | diosmosis <diosmosis@users.noreply.github.com> | 2020-11-19 11:20:29 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-19 11:20:29 +0300 |
commit | 0679149fdff4853ba90055414f69ac3e8d32900a (patch) | |
tree | 5181cf057905a7cd55fef4105d125b3f5fb419c6 /core | |
parent | 40ce0672484f6799e11da61d1d0b04bd4213d4fb (diff) |
handle "all" in removeInvalidationsFromDistributedList (#16752)
Diffstat (limited to 'core')
-rw-r--r-- | core/Archive/ArchiveInvalidator.php | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/core/Archive/ArchiveInvalidator.php b/core/Archive/ArchiveInvalidator.php index 2c60a6095f..6fe3980077 100644 --- a/core/Archive/ArchiveInvalidator.php +++ b/core/Archive/ArchiveInvalidator.php @@ -86,6 +86,11 @@ class ArchiveInvalidator */ private $logger; + /** + * @var int[] + */ + private $allIdSitesCache; + public function __construct(Model $model, ArchivingStatus $archivingStatus, LoggerInterface $logger) { $this->model = $model; @@ -615,6 +620,10 @@ class ArchiveInvalidator $list = new ReArchiveList(); $entries = $list->getAll(); + if ($idSites === 'all') { + $idSites = $this->getAllSitesId(); + } + foreach ($entries as $index => $entry) { $entry = @json_decode($entry, true); if (empty($entry)) { @@ -631,6 +640,10 @@ class ArchiveInvalidator continue; } + if ($sitesInEntry === 'all') { + $sitesInEntry = $this->getAllSitesId(); + } + $diffSites = array_diff($sitesInEntry, $idSites); if (empty($diffSites)) { unset($entries[$index]); @@ -757,8 +770,13 @@ class ArchiveInvalidator private function getAllSitesId() { + if (isset($this->allIdSitesCache)) { + return $this->allIdSitesCache; + } + $model = new \Piwik\Plugins\SitesManager\Model(); - return $model->getSitesId(); + $this->allIdSitesCache = $model->getSitesId(); + return $this->allIdSitesCache; } private function getEarliestDateToRearchive() |