);
$got_lock = true;
}
- elseif(! dbm::is_result($r)) { // the Boolean value for count($r) should be equivalent to the Boolean value of $r
+ elseif (! dbm::is_result($r)) {
+ /// @TODO the Boolean value for count($r) should be equivalent to the Boolean value of $r
q("INSERT INTO `locks` (`name`, `created`, `locked`) VALUES ('%s', '%s', 1)",
dbesc($fn_name),
dbesc(datetime_convert())
dbesc($fn_name)
);
- if(dbm::is_result($r) && $r[0]['locked'])
+ if (dbm::is_result($r) && $r[0]['locked'])
sleep($wait_sec);
} while(dbm::is_result($r) && $r[0]['locked'] && ((time() - $start) < $timeout));
if(! function_exists('unlock_function')) {
function unlock_function($fn_name) {
- $r = q("UPDATE `locks` SET `locked` = 0, `created` = '0000-00-00 00:00:00' WHERE `name` = '%s'",
+ $r = q("UPDATE `locks` SET `locked` = 0, `created` = '%s' WHERE `name` = '%s'",
+ dbesc(NULL_DATE),
dbesc($fn_name)
);