public static function UltimateCronLock::isLocked in Ultimate Cron 7.2
Check if lock is taken.
Parameters
string $name: Name of the lock.
bool $ignore_expiration: Ignore expiration, just check if it's present. Used for retrieving the lock id of an expired lock.
Return value
mixed The lock id if found, otherwise FALSE.
1 call to UltimateCronLock::isLocked()
- UltimateCronLock::expire in ./
ultimate_cron.lock.inc - Release lock if expired.
File
- ./
ultimate_cron.lock.inc, line 162 - A database-mediated implementation of a locking mechanism.
Class
- UltimateCronLock
- Class for handling lock functions.
Code
public static function isLocked($name, $ignore_expiration = FALSE) {
$target = _ultimate_cron_get_transactional_safe_connection();
$now = microtime(TRUE);
$result = db_select('ultimate_cron_lock', 'l', array(
'target' => $target,
))
->fields('l', array(
'lid',
'expire',
))
->condition('name', $name)
->condition('current', 0)
->execute()
->fetchObject();
return $result && ($result->expire > $now || $ignore_expiration) ? $result->lid : FALSE;
}