X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=vendor%2Fdrupal%2Fconsole%2Fsrc%2FCommand%2FServerCommand.php;h=e306ceecad63b0db5d82a4f086f96a895b008ac4;hb=e0411c4e83ba0d079034db83c3f7f55be24a0e35;hp=1d7fcb5e2e92a2ca0c72f008de2a32bf255c8711;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;p=yaffs-website diff --git a/vendor/drupal/console/src/Command/ServerCommand.php b/vendor/drupal/console/src/Command/ServerCommand.php index 1d7fcb5e2..e306ceeca 100644 --- a/vendor/drupal/console/src/Command/ServerCommand.php +++ b/vendor/drupal/console/src/Command/ServerCommand.php @@ -15,6 +15,7 @@ use Symfony\Component\Process\PhpExecutableFinder; use Symfony\Component\Console\Command\Command; use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Core\Style\DrupalStyle; +use \Drupal\Console\Core\Utils\ConfigurationManager; /** * Class ServerCommand @@ -25,8 +26,14 @@ class ServerCommand extends Command { use CommandTrait; + /** + * @var string + */ protected $appRoot; + /** + * @var ConfigurationManager + */ protected $configurationManager; /** @@ -65,13 +72,12 @@ class ServerCommand extends Command protected function execute(InputInterface $input, OutputInterface $output) { $io = new DrupalStyle($input, $output); - $learning = $input->hasOption('learning')?$input->getOption('learning'):false; $address = $this->validatePort($input->getArgument('address')); $finder = new PhpExecutableFinder(); if (false === $binary = $finder->find()) { $io->error($this->trans('commands.server.errors.binary')); - return; + return 1; } $router = $this->getRouterPath(); @@ -90,7 +96,7 @@ class ServerCommand extends Command $io->commentBlock( sprintf( $this->trans('commands.server.messages.listening'), - $address + 'http://'.$address ) ); @@ -99,7 +105,10 @@ class ServerCommand extends Command if (!$process->isSuccessful()) { $io->error($process->getErrorOutput()); + return 1; } + + return 0; } /** @@ -107,22 +116,26 @@ class ServerCommand extends Command */ private function getRouterPath() { - $router = sprintf( - '%s/.console/router.php', - $this->configurationManager->getHomeDirectory() - ); - - if (file_exists($router)) { - return $router; - } - - $router = sprintf( - '%s/config/dist/router.php', - $this->configurationManager->getApplicationDirectory() - ); + $routerPath = [ + sprintf( + '%s/.console/router.php', + $this->configurationManager->getHomeDirectory() + ), + sprintf( + '%s/console/router.php', + $this->configurationManager->getApplicationDirectory() + ), + sprintf( + '%s/%s/config/dist/router.php', + $this->configurationManager->getApplicationDirectory(), + DRUPAL_CONSOLE_CORE + ) + ]; - if (file_exists($router)) { - return $router; + foreach ($routerPath as $router) { + if (file_exists($router)) { + return $router; + } } return null;