Skip update if already done
This commit is contained in:
parent
4b5843ae30
commit
9a60eab152
1 changed files with 8 additions and 1 deletions
|
@ -68,7 +68,7 @@ class Update
|
||||||
Lock::release('dbupdate', true);
|
Lock::release('dbupdate', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$build = Config::get('system', 'build');
|
$build = Config::get('system', 'build', null, true);
|
||||||
|
|
||||||
if (empty($build) || ($build > DB_UPDATE_VERSION)) {
|
if (empty($build) || ($build > DB_UPDATE_VERSION)) {
|
||||||
$build = DB_UPDATE_VERSION - 1;
|
$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 the Lock is acquired, never release it automatically to avoid double updates
|
||||||
if (Lock::acquire('dbupdate', 120, Cache::INFINITE)) {
|
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
|
// run the pre_update_nnnn functions in update.php
|
||||||
for ($x = $stored + 1; $x <= $current; $x++) {
|
for ($x = $stored + 1; $x <= $current; $x++) {
|
||||||
$r = self::runUpdateFunction($x, 'pre_update');
|
$r = self::runUpdateFunction($x, 'pre_update');
|
||||||
|
|
Loading…
Reference in a new issue