mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
add function to check for a lock
This commit is contained in:
@ -60,12 +60,12 @@ function dbQuery($sql, $parameters=array()) {
|
||||
|
||||
|
||||
/*
|
||||
* Aquire a lock on a string
|
||||
* Check a lock on a string
|
||||
* */
|
||||
function dbGetLock($data, $timeout = 0) {
|
||||
$sql = 'SELECT GET_LOCK(\'' . $data . '\',' . $timeout . ')';
|
||||
$result = dbFetchCell($sql);
|
||||
return $result;
|
||||
function dbCheckLock($data, $timeout = 0) {
|
||||
$sql = 'SELECT IS_FREE_LOCK(\'' . $data . '\')';
|
||||
$result = dbFetchCell($sql);
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
@ -76,8 +76,9 @@ function dbReleaseLock($data, $timeout = 0) {
|
||||
$sql = 'SELECT RELEASE_LOCK(\'' . $data . '\')';
|
||||
$result = dbFetchCell($sql);
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Passed an array and a table name, it attempts to insert the data into the table.
|
||||
* Check for boolean false to determine whether insert failed
|
||||
|
@ -60,12 +60,12 @@ function dbQuery($sql, $parameters=array()) {
|
||||
|
||||
|
||||
/*
|
||||
* Aquire a lock on a string
|
||||
* Check a lock on a string
|
||||
* */
|
||||
function dbGetLock($data, $timeout = 0) {
|
||||
$sql = 'SELECT GET_LOCK(\'' . $data . '\',' . $timeout . ')';
|
||||
$result = dbFetchCell($sql);
|
||||
return $result;
|
||||
function dbCheckLock($data, $timeout = 0) {
|
||||
$sql = 'SELECT IS_FREE_LOCK(\'' . $data . '\')';
|
||||
$result = dbFetchCell($sql);
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
@ -76,6 +76,7 @@ function dbReleaseLock($data, $timeout = 0) {
|
||||
$sql = 'SELECT RELEASE_LOCK(\'' . $data . '\')';
|
||||
$result = dbFetchCell($sql);
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user