be smarter when guessing the document root
This commit is contained in:
parent
84f4c4b35b
commit
e28f5b8356
@ -44,7 +44,7 @@ class ServerRunCommand extends ContainerAwareCommand
|
|||||||
$this
|
$this
|
||||||
->setDefinition(array(
|
->setDefinition(array(
|
||||||
new InputArgument('address', InputArgument::OPTIONAL, 'Address:port', 'localhost:8000'),
|
new InputArgument('address', InputArgument::OPTIONAL, 'Address:port', 'localhost:8000'),
|
||||||
new InputOption('docroot', 'd', InputOption::VALUE_REQUIRED, 'Document root', 'web/'),
|
new InputOption('docroot', 'd', InputOption::VALUE_REQUIRED, 'Document root', null),
|
||||||
new InputOption('router', 'r', InputOption::VALUE_REQUIRED, 'Path to custom router script'),
|
new InputOption('router', 'r', InputOption::VALUE_REQUIRED, 'Path to custom router script'),
|
||||||
))
|
))
|
||||||
->setName('server:run')
|
->setName('server:run')
|
||||||
@ -83,6 +83,10 @@ EOF
|
|||||||
{
|
{
|
||||||
$documentRoot = $input->getOption('docroot');
|
$documentRoot = $input->getOption('docroot');
|
||||||
|
|
||||||
|
if (null === $documentRoot) {
|
||||||
|
$documentRoot = $this->getContainer()->getParameter('kernel.root_dir').'/../web';
|
||||||
|
}
|
||||||
|
|
||||||
if (!is_dir($documentRoot)) {
|
if (!is_dir($documentRoot)) {
|
||||||
$output->writeln(sprintf('<error>The given document root directory "%s" does not exist</error>', $documentRoot));
|
$output->writeln(sprintf('<error>The given document root directory "%s" does not exist</error>', $documentRoot));
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user