]> git.mxchange.org Git - friendica.git/commitdiff
Skip update if already done
authorPhilipp Holzer <admin@philipp.info>
Sun, 10 Mar 2019 18:59:20 +0000 (19:59 +0100)
committerPhilipp Holzer <admin@philipp.info>
Mon, 11 Mar 2019 20:21:01 +0000 (21:21 +0100)
src/Core/Update.php

index e0a7c4a266be545dd1b745a0c610ee17c4c957b1..aa400d1e8be0d1c51a4a876a58e182a9c8003f49 100644 (file)
@@ -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');