You are here

public function BackgroundProcess::execute in Background Process 7

Same name and namespace in other branches
  1. 8 background_process.class.php \BackgroundProcess::execute()
  2. 6 BackgroundProcess.class.php \BackgroundProcess::execute()
  3. 7.2 background_process.inc \BackgroundProcess::execute()
1 call to BackgroundProcess::execute()
BackgroundProcess::start in ./BackgroundProcess.class.php
Start background process

File

./BackgroundProcess.class.php, line 162
Class for handling background processes.

Class

BackgroundProcess
BackgroundProcess class.

Code

public function execute($callback, $args = array()) {
  $this->callback = $callback;
  $this->args = $args;
  if (!background_process_set_process($this->handle, $this->callback, $this->uid, $this->args, $this->token)) {

    // Could not update process
    return NULL;
  }
  module_invoke_all('background_process_pre_execute', $this->handle, $this->callback, $this->args, $this->token);

  // Initialize progress stats
  $old_db = db_set_active('background_process');
  progress_remove_progress($this->handle);
  db_set_active($old_db);
  $this->connection = FALSE;
  $this
    ->determineServiceHost();
  return $this
    ->dispatch();
}