You are here

public static function BackgroundProcess::create in Background Process 7.2

Instantiate a new BackgroundProcess object with data

Parameters

$data: stdClass object with data to populate BackgroundProcess object with

Return value

BackgroundProcess

4 calls to BackgroundProcess::create()
BackgroundProcess::load in ./background_process.inc
Load BackgroundProcess from the DB.
BackgroundProcess::loadAll in ./background_process.inc
Load all BackgroundProcess from the DB.
BackgroundProcess::loadByHandle in ./background_process.inc
Load BackgroundProcess from the DB.
background_process_cron in ./background_process.module
Implements hook_cron().

File

./background_process.inc, line 108
External API short overview

Class

BackgroundProcess
@file

Code

public static function create($data) {
  $process = new BackgroundProcess();
  foreach ($data as $key => $value) {
    $process->{$key} = $value;
  }
  $process->callback = unserialize($process->callback);
  $process->arguments = unserialize($process->arguments);
  $process->options = $process->options ? unserialize($process->options) : array();
  $process->options += self::defaultOptions();
  $process->start = $process->start_stamp;
  $process
    ->logDebug(__FUNCTION__);
  self::$processes['handle'][$process->handle] = $process;
  self::$processes['pid'][$process->pid] = $process;
  return $process;
}