Security update for Core, with self-updated composer
[yaffs-website] / vendor / drush / drush / lib / Drush / Boot / DrupalBoot8.php
index 468e963aae8d642defba8a02b91899dc32b9b345..bb537e7b2fca7c4697f3e22ca6657107523d7dfe 100644 (file)
@@ -160,19 +160,23 @@ class DrupalBoot8 extends DrupalBoot {
     // 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);
+    if ($container->has('drush.service.consolecommands')) {
+      $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);
+    if ($container->has('drush.service.consolidationcommands')) {
+      $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);
+        }
       }
     }
   }