You are here

public function InitSubscriber::onEvent in Background Process 8

Implements On Event.

File

src/EventSubscriber/InitSubscriber.php, line 23

Class

InitSubscriber
Default controller for the background_process module.

Namespace

Drupal\background_process\EventSubscriber

Code

public function onEvent() {

  // 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('system.site')
    ->get('install_task') != 'done') {
    return;
  }

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