/** * Overrides TelegramClient::start() */ function start() { // Try to acquire lock on the process. // If not available, wait for 10 secs and retry. if (!isset($this->lock)) { if (lock_acquire('telegram_client', 15.0)) { $this->lock = TRUE; } else { $this->logger->logInfo('Drupal. Waiting for lock to be available (15 seconds)'); $this->lock = lock_wait('telegram_client', 15); } } if ($this->lock) { return parent::start(); } else { $this->logger->logError('Drupal. Failed to acquire lock on the process'); return FALSE; } }
default: fatal_error('onmogelijke error'); } if ($_FILES['uploadedfile']['size'] == 0) { fatal_error('file with no content uploaded, impossible!'); } $filename = $_FILES['uploadedfile']['name']; function shutdown_function() { lock_release(); if (connection_aborted()) { fatal_error('user cancel'); } } register_shutdown_function('shutdown_function'); if (!lock_acquire('{ "state": 1, "perc": 0 }', $_POST['randid'])) { fatal_error('er is al een update bezig, even geduld AUB'); } // cache contents of table entities $entities = mdb2_all_ordered_rekey('SELECT entity_name, entity_id, entity_type FROM entities'); // cache een lijst leerlingen van wie we de naam al weten $names = mdb2_all_ordered_rekey('SELECT entity_id, name FROM names'); // cache een lijst met zermelo_id's $zermelo_ids = mdb2_all_assoc_rekey('SELECT zermelo_id_orig, zermelo_id FROM zermelo_ids'); $stamz = array(); function move_upload($bw, $md5, $week) { $new_filename = config('DATADIR') . $md5; logit($_FILES['uploadedfile']['name'] . ' -> ' . $md5); if (!move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $new_filename)) { logit('unable to store uploaded file for future reference');
<?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');
/** * Attempt to lock the supplied Lockable. * * @param LockableInterface $lockable * @param int $timeout * @return boolean */ public function lock(LockableInterface $lockable, $timeout = 3600) { return lock_acquire($lockable->getLockName(), $timeout); }