Esempio n. 1
0
 /**
  * Release the supplied Lockable, or all locks.
  *
  * @param LockableInterface $lockable
  * @return mixed
  */
 public function release(LockableInterface $lockable = NULL)
 {
     if ($lockable == NULL) {
         lock_release_all();
         return;
     }
     lock_release($lockable->getLockName());
 }
Esempio n. 2
0
function shutdown_function()
{
    lock_release();
    if (connection_aborted()) {
        fatal_error('user cancel');
    }
}
 /**
  * Overrides TelegramClient::stop()
  */
 function stop()
 {
     if (!empty($this->lock)) {
         lock_release('telegram_client');
         unset($this->lock);
     }
     return parent::stop();
 }
<?php

/**
 * @file
 * os2web_esdh_provider.queue.php
 *
 * Let the meetings importer run via CLI instead of HTTP
 *
 * Run with Drush php-script
 * "drush scr os2web_esdh_provider.queue.php"
 */
require_once 'os2web_esdh_provider.mmapi.inc';
os2web_esdh_provider_queue_meetings();
if (lock_acquire('os2web_esdh_provider_queue', 10000)) {
    $queue = DrupalQueue::get('acadre_mm_import');
    while ($item = $queue->claimItem()) {
        _os2web_esdh_provider_cron_queue_worker($item->data);
        $queue->deleteItem($item);
    }
}
lock_release('os2web_esdh_provider_queue');
/** release lock on a node
 *
 * this is a wrapper around {@link lock_release()} for unlocking nodes.
 *
 * @param int $node_id the primary key of the node record to unlock
 * @return bool TRUE if locked removed succesfully, FALSE on error or lock not found
 * @uses lock_record()
 */
function lock_release_node($node_id)
{
    return lock_release($node_id, 'nodes', 'node_id', 'locked_by_session_id', 'locked_since');
}