You are here

class InitSubscriber in Background Process 8

Default controller for the background_process module.

Hierarchy

  • class \Drupal\background_process\EventSubscriber\InitSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface

Expanded class hierarchy of InitSubscriber

1 string reference to 'InitSubscriber'
background_process.services.yml in ./background_process.services.yml
background_process.services.yml
1 service uses InitSubscriber
init_subscriber in ./background_process.services.yml
Drupal\background_process\EventSubscriber\InitSubscriber

File

src/EventSubscriber/InitSubscriber.php, line 11

Namespace

Drupal\background_process\EventSubscriber
View source
class InitSubscriber implements EventSubscriberInterface {

  /**
   * Implements to Subscribe Events.
   */
  public static function getSubscribedEvents() {
    return [
      KernelEvents::REQUEST => [
        'onEvent',
        0,
      ],
    ];
  }

  /**
   * Implements On Event.
   */
  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']);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
InitSubscriber::getSubscribedEvents public static function Implements to Subscribe Events.
InitSubscriber::onEvent public function Implements On Event.