function DrupalBoot8::bootstrap_drupal_full

8.0.x DrupalBoot8.php DrupalBoot8::bootstrap_drupal_full()
7.x DrupalBoot8.php DrupalBoot8::bootstrap_drupal_full()
master DrupalBoot8.php DrupalBoot8::bootstrap_drupal_full()

Attempt to load the full Drupal system.

Overrides DrupalBoot::bootstrap_drupal_full

File

lib/Drush/Boot/DrupalBoot8.php, line 143

Namespace

Drush\Boot

Class

DrupalBoot8

Code

function bootstrap_drupal_full() {
  drush_log(dt('About to bootstrap the Drupal 8 Kernel.'), LogLevel::DEBUG);
  // TODO: do we need to do ob_start any longer?
  if (!drush_get_context('DRUSH_QUIET', FALSE)) {
    ob_start();
  }
  $this->kernel->invalidateContainer();
  $this->kernel->boot();
  $this->kernel->prepareLegacyRequest($this->request);
  if (!drush_get_context('DRUSH_QUIET', FALSE)) {
    ob_end_clean();
  }
  drush_log(dt('Finished bootstraping the Drupal 8 Kernel.'), LogLevel::DEBUG);

  parent::bootstrap_drupal_full();

  // Get a list of the modules to ignore
  $ignored_modules = drush_get_option_list('ignored-modules', array());

  // We have to get the service command list from the container, because
  // it is constructed in an indirect way during the container initialization.
  // The upshot is that the list of console commands is not available
  // until after $kernel->boot() is called.
  $container = \Drupal::getContainer();
  $serviceCommandlist = $container->get('drush.service.consolecommands');
  foreach ($serviceCommandlist->getCommandList() as $command) {
    if (!$this->commandIgnored($command, $ignored_modules)) {
      drush_log(dt('Add a command: !name', ['!name' $command->getName()]), LogLevel::DEBUG);
      annotationcommand_adapter_cache_module_console_commands($command);
    }
  }
  // Do the same thing with the annotation commands.
  $serviceCommandlist = $container->get('drush.service.consolidationcommands');
  foreach ($serviceCommandlist->getCommandList() as $commandhandler) {
    if (!$this->commandIgnored($commandhandler, $ignored_modules)) {
      drush_log(dt('Add a commandhandler: !name', ['!name' get_class($commandhandler)]), LogLevel::DEBUG);
      annotationcommand_adapter_cache_module_service_commands($commandhandler);
    }
  }
}