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
diff options
context:
space:
mode:
authorThomas Steur <tsteur@users.noreply.github.com>2020-12-18 03:53:56 +0300
committerGitHub <noreply@github.com>2020-12-18 03:53:56 +0300
commitecda65f711bd29c608ffeae50c085d25012b74db (patch)
tree2a3497c105d4b931e354853d1078648271528ee4
parent00f0c9d085e6d644b5bc2e38e64a01d2d72cde46 (diff)
Invalidate archives after deleting a visit to prevent race conditions (#16967)
* Invalidate archives after deleting a visit to prevent race conditions The deletion of visits can take a while. To prevent any possible race condition we should invalidate archives only after the visits were deleted. We recently deleted few visits and noticed the reports are still showing the wrong data. Not sure if this was the problem but be still good to change. * fix test Co-authored-by: diosmosis <diosmosis@users.noreply.github.com>
-rw-r--r--plugins/PrivacyManager/Model/DataSubjects.php8
1 files changed, 4 insertions, 4 deletions
diff --git a/plugins/PrivacyManager/Model/DataSubjects.php b/plugins/PrivacyManager/Model/DataSubjects.php
index 6c5d7583c3..1819b20bfb 100644
--- a/plugins/PrivacyManager/Model/DataSubjects.php
+++ b/plugins/PrivacyManager/Model/DataSubjects.php
@@ -107,22 +107,22 @@ class DataSubjects
*/
Piwik::postEvent('PrivacyManager.deleteDataSubjects', array(&$results, $visits));
- $this->invalidateArchives($visits);
+ $datesToInvalidateByIdSite = $this->getDatesToInvalidate($visits);
$logTables = $this->getLogTablesToDeleteFrom();
$deleteCounts = $this->deleteLogDataFrom($logTables, function ($tableToSelectFrom) use ($visits) {
return $this->visitsToWhereAndBind($tableToSelectFrom, $visits);
});
+ $this->invalidateArchives($datesToInvalidateByIdSite);
+
$results = array_merge($results, $deleteCounts);
krsort($results); // make sure test results are always in same order
return $results;
}
- private function invalidateArchives($visits)
+ private function invalidateArchives($datesToInvalidateByIdSite)
{
- $datesToInvalidateByIdSite = $this->getDatesToInvalidate($visits);
-
$invalidator = StaticContainer::get('Piwik\Archive\ArchiveInvalidator');
foreach ($datesToInvalidateByIdSite as $idSite => $visitDates) {