Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
[WebServerBundle] allowed public/ root directory to be auto-discovere…
…d along side web/
  • Loading branch information
fabpot committed Jul 16, 2017
commit 34c8566be140d6fffff5dae3a055c986b8c45740
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 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 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