X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=include%2Flock.php;h=b3d488a3577fba08fe2bf01bf5ac44c689f3cf12;hb=cb0600976d9b8b532d1276196a4ce329e78e3240;hp=31b18191a9c7f7b3af8dadc5c80321dfc2fa8128;hpb=c825cc8d0d61386cb00b6310fc4ea46c4354460d;p=friendica.git diff --git a/include/lock.php b/include/lock.php index 31b18191a9..b3d488a357 100644 --- a/include/lock.php +++ b/include/lock.php @@ -23,7 +23,8 @@ function lock_function($fn_name, $block = true, $wait_sec = 2, $timeout = 30) { ); $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)) { + /// @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()) @@ -56,10 +57,10 @@ function block_on_function_lock($fn_name, $wait_sec = 2, $timeout = 30) { 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; }}