diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index a683be1313..30188c11ae 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -2176,6 +2176,32 @@ function db_check_minor_relase_available_to_um($package, $ent, $offline) } +/** + * Checks if a lock is free or not. + * + * @param string $lockname Name. + * + * @return boolean Free or not. + */ +function db_is_free_lock($lockname) +{ + global $config; + // Temporary disable to get a valid lock if any... + $cache = $config['dbcache']; + $config['dbcache'] = false; + $lock_status = db_get_value_sql( + sprintf( + 'SELECT IS_FREE_LOCK("%s")', + $lockname + ) + ); + + $config['dbcache'] = $cache; + + return (bool) $lock_status; +} + + /** * Tries to get a lock with current name. *