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
path: root/core
diff options
context:
space:
mode:
authordiosmosis <diosmosis@users.noreply.github.com>2020-11-19 11:20:29 +0300
committerGitHub <noreply@github.com>2020-11-19 11:20:29 +0300
commit0679149fdff4853ba90055414f69ac3e8d32900a (patch)
tree5181cf057905a7cd55fef4105d125b3f5fb419c6 /core
parent40ce0672484f6799e11da61d1d0b04bd4213d4fb (diff)
handle "all" in removeInvalidationsFromDistributedList (#16752)
Diffstat (limited to 'core')
-rw-r--r--core/Archive/ArchiveInvalidator.php20
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()