);
$got_lock = true;
}
- elseif(! $r) { // the Boolean value for count($r) should be equivalent to the Boolean value of $r
+ elseif(! dbm::is_result($r)) { // 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(count($r) && $r[0]['locked'])
+ if (dbm::is_result($r) && $r[0]['locked'])
sleep($wait_sec);
- } while(count($r) && $r[0]['locked'] && ((time() - $start) < $timeout));
+ } while(dbm::is_result($r) && $r[0]['locked'] && ((time() - $start) < $timeout));
return;
}}