You are here

public static function UltimateCronLock::expire in Ultimate Cron 7.2

Release lock if expired.

Checks if expiration time has been reached, and releases the lock if so.

Parameters

string $name: The name of the lock.

1 call to UltimateCronLock::expire()
UltimateCronLock::lock in ./ultimate_cron.lock.inc
Acquire lock.

File

./ultimate_cron.lock.inc, line 97
A database-mediated implementation of a locking mechanism.

Class

UltimateCronLock
Class for handling lock functions.

Code

public static function expire($name) {
  if ($lock_id = self::isLocked($name, TRUE)) {
    $target = _ultimate_cron_get_transactional_safe_connection();
    $now = microtime(TRUE);
    db_update('ultimate_cron_lock', array(
      'target' => $target,
    ))
      ->expression('current', 'lid')
      ->condition('lid', $lock_id)
      ->condition('expire', $now, '<=')
      ->execute();
  }
}