From 9a60eab15251e1a429cb2741f562fa0841cdd137 Mon Sep 17 00:00:00 2001 From: Philipp Holzer Date: Sun, 10 Mar 2019 19:59:20 +0100 Subject: [PATCH] Skip update if already done --- src/Core/Update.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Core/Update.php b/src/Core/Update.php index e0a7c4a266..aa400d1e8b 100644 --- a/src/Core/Update.php +++ b/src/Core/Update.php @@ -68,7 +68,7 @@ class Update Lock::release('dbupdate', true); } - $build = Config::get('system', 'build'); + $build = Config::get('system', 'build', null, true); if (empty($build) || ($build > DB_UPDATE_VERSION)) { $build = DB_UPDATE_VERSION - 1; @@ -89,6 +89,13 @@ class Update // If the Lock is acquired, never release it automatically to avoid double updates if (Lock::acquire('dbupdate', 120, Cache::INFINITE)) { + // Checks if the build changed during Lock acquiring (so no double update occurs) + $retryBuild = Config::get('system', 'build', null, true); + if ($retryBuild !== $build) { + Lock::release('dbupdate'); + return ''; + } + // run the pre_update_nnnn functions in update.php for ($x = $stored + 1; $x <= $current; $x++) { $r = self::runUpdateFunction($x, 'pre_update'); -- 2.39.5