Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/Symfony/Bundle/WebServerBundle/Command/ServerRunCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output instanceof ConsoleOutputInterface ? $output->getErrorOutput() : $output);

// deprecated, logic to be removed in 4.0
// this allows the commands to work out of the box with web/ and public/
if ($this->documentRoot && !is_dir($this->documentRoot) && is_dir(dirname($this->documentRoot).'/web')) {
$this->documentRoot = dirname($this->documentRoot).'/web';
}

if (null === $documentRoot = $input->getOption('docroot')) {
if (!$this->documentRoot) {
$io->error('The document root directory must be either passed as first argument of the constructor or through the "--docroot" input option.');
Expand All @@ -97,12 +103,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
$documentRoot = $this->documentRoot;
}

if (!is_dir($documentRoot)) {
$io->error(sprintf('The document root directory "%s" does not exist.', $documentRoot));

return 1;
}

if (!$env = $this->environment) {
if ($input->hasOption('env') && !$env = $input->getOption('env')) {
$io->error('The environment must be either passed as second argument of the constructor or through the "--env" input option.');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ protected function execute(InputInterface $input, OutputInterface $output)
return 1;
}

// deprecated, logic to be removed in 4.0
// this allows the commands to work out of the box with web/ and public/
if ($this->documentRoot && !is_dir($this->documentRoot) && is_dir(dirname($this->documentRoot).'/web')) {
$this->documentRoot = dirname($this->documentRoot).'/web';
}

if (null === $documentRoot = $input->getOption('docroot')) {
if (!$this->documentRoot) {
$io->error('The document root directory must be either passed as first argument of the constructor or through the "docroot" input option.');
Expand All @@ -109,12 +115,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
$documentRoot = $this->documentRoot;
}

if (!is_dir($documentRoot)) {
$io->error(sprintf('The document root directory "%s" does not exist.', $documentRoot));

return 1;
}

if (!$env = $this->environment) {
if ($input->hasOption('env') && !$env = $input->getOption('env')) {
$io->error('The environment must be either passed as second argument of the constructor or through the "--env" input option.');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
<defaults public="false" />

<service id="web_server.command.server_run" class="Symfony\Bundle\WebServerBundle\Command\ServerRunCommand">
<argument>%kernel.project_dir%/web</argument>
<argument>%kernel.project_dir%/public</argument>
<argument>%kernel.environment%</argument>
<tag name="console.command" />
</service>

<service id="web_server.command.server_start" class="Symfony\Bundle\WebServerBundle\Command\ServerStartCommand">
<argument>%kernel.project_dir%/web</argument>
<argument>%kernel.project_dir%/public</argument>
<argument>%kernel.environment%</argument>
<tag name="console.command" />
</service>
Expand Down