You are here

function background_process_get_process in Background Process 8

Same name and namespace in other branches
  1. 6 background_process.module \background_process_get_process()
  2. 7.2 background_process.module \background_process_get_process()
  3. 7 background_process.module \background_process_get_process()

Get background process.

8 calls to background_process_get_process()
BackgroundProcess::lock in ./background_process.class.php
Implements to Lock the Background Process.
background_process_ass_cron_alter in background_process_ass/background_process_ass.module
Implements hook_cron_alter().
background_process_cron_alter in ./background_process.module
Implements hook_cron_alter().
background_process_keepalive in ./background_process.module
Implements to Keep process alive.
background_process_service_access in ./background_process.module
Implements to Access handler for service call.

... See full list

File

./background_process.module, line 629
This module implements a framework for calling funtions in the background.

Code

function background_process_get_process($handle) {
  try {
    $old_db = Database::setActiveConnection('background_process');
    $result = db_select('background_process', 'bp')
      ->fields('bp', [
      'handle',
      'callback',
      'args',
      'uid',
      'token',
      'service_host',
      'start_stamp',
      'exec_status',
    ])
      ->condition('handle', $handle)
      ->execute()
      ->fetchObject();
    Database::setActiveConnection($old_db);
  } catch (Exception $e) {
    Database::setActiveConnection($old_db);
    throw $e;
  }
  if ($result) {
    $result->args = unserialize($result->args);
    $result->callback = unserialize($result->callback);
    $result->start = $result->start_stamp;
    $result->status = $result->exec_status;
    return $result;
  }
  return FALSE;
}