You are here

function background_process_unlock in Background Process 7

Same name and namespace in other branches
  1. 8 background_process.module \background_process_unlock()
  2. 6 background_process.module \background_process_unlock()

Unlock background process.

Parameters

string $handle: Handle of process to unlock

5 calls to background_process_unlock()
background_process_ass_cron_alter in background_process_ass/background_process_ass.module
Implements hook_cron_alter().
background_process_cron in ./background_process.module
Implements hook_cron().
background_process_cron_alter in ./background_process.module
Implements hook_cron_alter().
background_process_service_unlock in ./background_process.admin.inc
Unlock background process.
_background_process_ass_unlock in background_process_ass/background_process_ass.module

File

./background_process.module, line 862

Code

function background_process_unlock($handle, $msg = NULL, $start = NULL) {
  $process = background_process_get_process($handle);
  if ($process && (!isset($start) || $start === $process->start)) {

    // Unlock the process.
    if (background_process_remove_process($process->handle, $process->start)) {
      global $user;
      $username = $user->uid ? $user->name : t('anonymous');
      module_invoke_all('background_process_shutdown', $process, $msg ? $msg : t('Manually unlocked by !name', array(
        '!name' => $username,
      )));
      return TRUE;
    }
  }
  return FALSE;
}