diff options
author | Thomas Steur <tsteur@users.noreply.github.com> | 2022-03-24 22:04:15 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-24 22:04:15 +0300 |
commit | 5a3ae2d7ff17d1d6bd11ffa65f78101c296bd99e (patch) | |
tree | 2f75eeb4a6926638ed7e2a3c630b9c5fd1bc95b6 /core | |
parent | 3e18d4a0a42f04a59a62dc58a0795e2f4acf323e (diff) |
Minor performance improvement for archive invalidator (#18990)
Diffstat (limited to 'core')
-rw-r--r-- | core/Archive/ArchiveInvalidator.php | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/core/Archive/ArchiveInvalidator.php b/core/Archive/ArchiveInvalidator.php index 0ef586fe8c..b05412c95f 100644 --- a/core/Archive/ArchiveInvalidator.php +++ b/core/Archive/ArchiveInvalidator.php @@ -96,7 +96,7 @@ class ArchiveInvalidator // we do not really have to get the value first. we could simply always try to call set() and it would update or // insert the record if needed but we do not want to lock the table (especially since there are still some // MyISAM installations) - $values = Option::getLike('%' . $this->rememberArchivedReportIdStart . '%'); + $values = Option::getLike('%' . str_replace('_', '\_', $this->rememberArchivedReportIdStart) . '%'); $all = []; foreach ($values as $name => $value) { @@ -121,7 +121,7 @@ class ArchiveInvalidator // we do not really have to get the value first. we could simply always try to call set() and it would update or // insert the record if needed but we do not want to lock the table (especially since there are still some // MyISAM installations) - $value = Option::getLike('%' . $key . '%'); + $value = Option::getLike('%' . str_replace('_', '\_', $key) . '%'); } // getLike() returns an empty array rather than 'false' @@ -154,7 +154,7 @@ class ArchiveInvalidator public function getRememberedArchivedReportsThatShouldBeInvalidated() { - $reports = Option::getLike('%' . $this->rememberArchivedReportIdStart . '%_%'); + $reports = Option::getLike('%' . str_replace('_', '\_', $this->rememberArchivedReportIdStart) . '%\_%'); $sitesPerDay = array(); @@ -204,7 +204,7 @@ class ArchiveInvalidator public function forgetRememberedArchivedReportsToInvalidateForSite($idSite) { - $id = $this->buildRememberArchivedReportIdForSite($idSite) . '\_'; + $id = $this->buildRememberArchivedReportIdForSite($idSite) . '_'; $this->deleteOptionLike($id); Cache::clearCacheGeneral(); } @@ -227,7 +227,7 @@ class ArchiveInvalidator { // we're not using deleteLike since it maybe could cause deadlocks see https://github.com/matomo-org/matomo/issues/15545 // we want to reduce number of rows scanned and only delete specific primary key - $keys = Option::getLike('%' . $id . '%'); + $keys = Option::getLike('%' . str_replace('_', '\_', $id) . '%'); if (empty($keys)) { return; |