mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
fix: Don't lock the schema during install.php (#7051)
This commit is contained in:
committed by
Neil Lathwood
parent
dedfc6c1d8
commit
8e85eebe32
@@ -25,7 +25,7 @@
|
||||
*/
|
||||
|
||||
if (!isset($init_modules)) {
|
||||
$opts = getopt('dh:u:p:n:t:s:');
|
||||
$opts = getopt('ldh:u:p:n:t:s:');
|
||||
|
||||
$db_vars = array(
|
||||
'db_host' => 'h',
|
||||
@@ -47,6 +47,7 @@ if (!isset($init_modules)) {
|
||||
require __DIR__ . '/includes/init.php';
|
||||
|
||||
$debug = isset($opts['d']);
|
||||
$skip_schema_lock = isset($opts['l']);
|
||||
}
|
||||
|
||||
require 'includes/sql-schema/update.php';
|
||||
|
@@ -40,7 +40,7 @@ $db_vars = array(
|
||||
'dbsocket' => 's',
|
||||
);
|
||||
|
||||
$cmd = $config['install_dir'] . '/build-base.php';
|
||||
$cmd = $config['install_dir'] . '/build-base.php -l';
|
||||
|
||||
foreach ($db_vars as $var => $opt) {
|
||||
if ($_SESSION[$var]) {
|
||||
|
@@ -18,7 +18,12 @@ if (!isset($init_modules) && php_sapi_name() == 'cli') {
|
||||
require realpath(__DIR__ . '/../..') . '/includes/init.php';
|
||||
}
|
||||
|
||||
$schemaLock = \LibreNMS\FileLock::lock('schema', 30);
|
||||
if (isset($skip_schema_lock) && $skip_schema_lock) {
|
||||
$schemaLock = true;
|
||||
} else {
|
||||
$schemaLock = \LibreNMS\FileLock::lock('schema', 30);
|
||||
}
|
||||
|
||||
if ($schemaLock === false) {
|
||||
echo "Failed to acquire lock, skipping schema update\n";
|
||||
$return = 1;
|
||||
@@ -110,5 +115,7 @@ if ($schemaLock === false) {
|
||||
}
|
||||
}
|
||||
|
||||
$schemaLock->release();
|
||||
if (is_a($schemaLock, '\LibreNMS\FileLock')) {
|
||||
$schemaLock->release();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user