public function Lock::isLocked in Ultimate Cron 8.2
Check if lock is taken.
Parameters
string $job_id: Name of the lock.
boolean $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.
Overrides LockInterface::isLocked
1 call to Lock::isLocked()
- Lock::expire in src/
Lock/ Lock.php - Release lock if expired.
File
- src/
Lock/ Lock.php, line 170
Class
- Lock
- Class for handling lock functions.
Namespace
Drupal\ultimate_cron\LockCode
public function isLocked($job_id, $ignore_expiration = FALSE) {
$now = microtime(TRUE);
$result = $this->connection
->select('ultimate_cron_lock', 'l')
->fields('l', array(
'lid',
'expire',
))
->condition('name', $job_id)
->condition('current', 0)
->execute()
->fetchObject();
return $result && ($result->expire > $now || $ignore_expiration) ? $result->lid : FALSE;
}