move lock checks after bail out

This commit is contained in:
Clint Armstrong
2015-07-22 08:32:30 -04:00
parent c5fcb87b51
commit e74a6db216

View File

@@ -31,15 +31,6 @@ if (!isset($debug)) {
}
}
if (!dbGetLock('schema_update')) {
echo "Schema update already in progress. Exiting\n";
exit(1);
} //end if
do {
sleep(1);
} while (@dbFetchCell('SELECT COUNT(*) FROM `devices` WHERE NOT IS_FREE_LOCK(CONCAT("polling.", device_id)) OR NOT IS_FREE_LOCK(CONCAT("queued.", device_id)) OR NOT IS_FREE_LOCK(CONCAT("discovering.", device_id))') > 0);
$insert = 0;
if ($db_rev = @dbFetchCell('SELECT version FROM `dbSchema` ORDER BY version DESC LIMIT 1')) {
@@ -100,6 +91,15 @@ if (explode('.', max($filelist), 2) <= $db_rev) {
exit(0);
}
if (!dbGetLock('schema_update')) {
echo "Schema update already in progress. Exiting\n";
exit(1);
} //end if
do {
sleep(1);
} while (@dbFetchCell('SELECT COUNT(*) FROM `devices` WHERE NOT IS_FREE_LOCK(CONCAT("polling.", device_id)) OR NOT IS_FREE_LOCK(CONCAT("queued.", device_id)) OR NOT IS_FREE_LOCK(CONCAT("discovering.", device_id))') > 0);
foreach ($filelist as $file) {
list($filename,$extension) = explode('.', $file, 2);
if ($filename > $db_rev) {