X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fdrupal%2Fconsole-core%2Fsrc%2FCommand%2FSite%2FDebugCommand.php;fp=vendor%2Fdrupal%2Fconsole-core%2Fsrc%2FCommand%2FSite%2FDebugCommand.php;h=c91af67b07886d06eaadd00e200e2d5dbab5fad9;hp=0000000000000000000000000000000000000000;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad diff --git a/vendor/drupal/console-core/src/Command/Site/DebugCommand.php b/vendor/drupal/console-core/src/Command/Site/DebugCommand.php new file mode 100644 index 000000000..c91af67b0 --- /dev/null +++ b/vendor/drupal/console-core/src/Command/Site/DebugCommand.php @@ -0,0 +1,102 @@ +configurationManager = $configurationManager; + parent::__construct(); + } + + /** + * @{@inheritdoc} + */ + public function configure() + { + $this + ->setName('site:debug') + ->setDescription($this->trans('commands.site.debug.description')) + ->addArgument( + 'target', + InputArgument::OPTIONAL, + $this->trans('commands.site.debug.options.target'), + null + ) + ->setHelp($this->trans('commands.site.debug.help')); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + $sites = array_keys($this->configurationManager->getSites()); + + if (!$sites) { + $io->error($this->trans('commands.site.debug.messages.invalid-sites')); + + return 1; + } + + // --target argument + $target = $input->getArgument('target'); + if (!$target) { + $tableHeader =[ + $this->trans('commands.site.debug.messages.site'), + ]; + + $io->table($tableHeader, $sites); + + return 0; + } + + $targetConfig = $this->configurationManager->readTarget($target); + if (!$targetConfig) { + $io->error($this->trans('commands.site.debug.messages.invalid-site')); + + return 1; + } + + $io->info($target); + $dumper = new Dumper(); + $io->writeln($dumper->dump($targetConfig, 2)); + + return 0; + } +}