diff options
author | diosmosis <diosmosis@users.noreply.github.com> | 2020-11-18 23:04:51 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-18 23:04:51 +0300 |
commit | e2f49032a4bd1c38f32e05c7450f7179117c18d9 (patch) | |
tree | d218d8ac73e1a35b4ce178b25ebfc812d43ccb93 /core | |
parent | 74271243d13327696fa252179ba555f31a4b1510 (diff) |
add check for dangling invalidations (#16739)
Diffstat (limited to 'core')
-rw-r--r-- | core/CronArchive.php | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/core/CronArchive.php b/core/CronArchive.php index 2e39499685..df98bd3274 100644 --- a/core/CronArchive.php +++ b/core/CronArchive.php @@ -489,6 +489,9 @@ class CronArchive $this->requests += count($urls); + $idInvalidations = array_column($archives, 'idinvalidation'); + $this->checkNoDanglingInvalidations($idInvalidations); + return $successCount; } @@ -1234,4 +1237,25 @@ class CronArchive return new SharedSiteIds($websitesIds, SharedSiteIds::OPTION_ALL_WEBSITES); } + + /** + * @deprecaed + */ + public function checkNoDanglingInvalidations(array $idInvalidations) + { + $table = Common::prefixTable('archive_invalidations'); + $idInvalidations = array_map('intval', $idInvalidations); + + $sql = "SELECT idinvalidation FROM `$table` WHERE idinvalidation IN (" . implode(',', $idInvalidations) . ") AND status = " + . ArchiveInvalidator::INVALIDATION_STATUS_IN_PROGRESS; + + $inProgress = Db::fetchAll($sql); + $inProgress = array_column($inProgress, 'idinvalidation'); + + if (!empty($inProgress)) { + $this->logger->error("Found dangling invalidations that were not correctly reset or removed, this should be reported on the forums: {invalidations}", [ + 'idinvalidations' => json_encode($inProgress), + ]); + } + } } |