refactor: DB Updates will now file level lock to stop duplicate updates (#6469)

* refactor: DB Updates will now file level lock to stop duplicate updates

* scrut fixes

* renamed function from clear_lock() to release_lock()
This commit is contained in:
Neil Lathwood
2017-05-03 14:48:23 +01:00
committed by GitHub
parent 0dcc1d18c5
commit 41e7689c77
10 changed files with 82 additions and 27 deletions

View File

@@ -15,6 +15,8 @@
* See COPYING for more details.
*/
set_lock('schema');
if (!isset($debug) && php_sapi_name() == 'cli') {
// Not called from within discovery, let's load up the necessary stuff.
$init_modules = array();
@@ -24,8 +26,11 @@ if (!isset($debug) && php_sapi_name() == 'cli') {
$debug = isset($options['d']);
}
d_echo("DB Schema update started....\n");
if (db_schema_is_current()) {
d_echo("DB Schema already up to date.\n");
release_lock('schema');
return;
}
@@ -91,3 +96,5 @@ if ($updating) {
$_SESSION['build-ok'] = true;
}
}
release_lock('schema');