X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=vendor%2Fdrupal%2Fconsole%2Fsrc%2FCommand%2FDebug%2FMultisiteCommand.php;fp=vendor%2Fdrupal%2Fconsole%2Fsrc%2FCommand%2FDebug%2FMultisiteCommand.php;h=f4fbd744bb42460360e322395a143906b01424a4;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hp=0000000000000000000000000000000000000000;hpb=aea91e65e895364e460983b890e295aa5d5540a5;p=yaffs-website diff --git a/vendor/drupal/console/src/Command/Debug/MultisiteCommand.php b/vendor/drupal/console/src/Command/Debug/MultisiteCommand.php new file mode 100644 index 000000000..f4fbd744b --- /dev/null +++ b/vendor/drupal/console/src/Command/Debug/MultisiteCommand.php @@ -0,0 +1,92 @@ +appRoot = $appRoot; + parent::__construct(); + } + + /** + * {@inheritdoc} + */ + public function configure() + { + $this + ->setName('debug:multisite') + ->setDescription($this->trans('commands.debug.multisite.description')) + ->setHelp($this->trans('commands.debug.multisite.help')) + ->setAliases(['dmu']); + ; + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $sites = []; + + $multiSiteFile = sprintf( + '%s/sites/sites.php', + $this->appRoot + ); + + if (file_exists($multiSiteFile)) { + include $multiSiteFile; + } + + if (!$sites) { + $this->getIo()->error( + $this->trans('commands.debug.multisite.messages.no-multisites') + ); + + return 1; + } + + $this->getIo()->info( + $this->trans('commands.debug.multisite.messages.site-format') + ); + + $tableHeader = [ + $this->trans('commands.debug.multisite.messages.site'), + $this->trans('commands.debug.multisite.messages.directory'), + ]; + + $tableRows = []; + foreach ($sites as $site => $directory) { + $tableRows[] = [ + $site, + $this->appRoot . '/sites/' . $directory + ]; + } + + $this->getIo()->table($tableHeader, $tableRows); + + return 0; + } +}