You are here

function background_process_init in Background Process 8

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

Implements hook_init().

File

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

Code

function background_process_init() {

  // Only determine if we're told to do so.
  if (empty($_SESSION['background_process_determine_default_service_host'])) {
    return;
  }

  // Don't determine on check-token page, to avoid infinite loop.
  if (strpos($_GET['q'], 'background-process/check-token') === 0) {
    return;
  }
  if (\Drupal::config('install_task')
    ->get() != 'done') {
    return;
  }

  // Determine the default service host.
  background_process_determine_and_save_default_service_host();
  unset($_SESSION['background_process_determine_default_service_host']);
}