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

Skip to content

Commit a8e298a

Browse files
committed
use getProjectDir() when possible
1 parent b1349a7 commit a8e298a

File tree

4 files changed

+7
-10
lines changed

4 files changed

+7
-10
lines changed

src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
4646

4747
/** @var $kernel KernelInterface */
4848
$kernel = $this->getContainer()->get('kernel');
49-
$baseDir = realpath($kernel->getRootDir().DIRECTORY_SEPARATOR.'..');
5049

5150
$io->table(array(), array(
5251
array('<info>Symfony</>'),
@@ -62,9 +61,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
6261
array('Environment', $kernel->getEnvironment()),
6362
array('Debug', $kernel->isDebug() ? 'true' : 'false'),
6463
array('Charset', $kernel->getCharset()),
65-
array('Root directory', self::formatPath($kernel->getRootDir(), $baseDir)),
66-
array('Cache directory', self::formatPath($kernel->getCacheDir(), $baseDir).' (<comment>'.self::formatFileSize($kernel->getCacheDir()).'</>)'),
67-
array('Log directory', self::formatPath($kernel->getLogDir(), $baseDir).' (<comment>'.self::formatFileSize($kernel->getLogDir()).'</>)'),
64+
array('Root directory', self::formatPath($kernel->getRootDir(), $kernel->getProjectDir())),
65+
array('Cache directory', self::formatPath($kernel->getCacheDir(), $kernel->getProjectDir()).' (<comment>'.self::formatFileSize($kernel->getCacheDir()).'</>)'),
66+
array('Log directory', self::formatPath($kernel->getLogDir(), $kernel->getProjectDir()).' (<comment>'.self::formatFileSize($kernel->getLogDir()).'</>)'),
6867
new TableSeparator(),
6968
array('<info>PHP</>'),
7069
new TableSeparator(),

src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
8282
$targetArg = rtrim($input->getArgument('target'), '/');
8383

8484
if (!is_dir($targetArg)) {
85-
$appRoot = $this->getContainer()->getParameter('kernel.root_dir').'/..';
86-
87-
$targetArg = $appRoot.'/'.$targetArg;
85+
$targetArg = $this->getContainer()->getParameter('kernel.project_dir').'/'.$targetArg;
8886

8987
if (!is_dir($targetArg)) {
9088
throw new \InvalidArgumentException(sprintf('The target directory "%s" does not exist.', $input->getArgument('target')));

src/Symfony/Bundle/WebServerBundle/Resources/config/webserver.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
<defaults public="false" />
99

1010
<service id="web_server.command.server_run" class="Symfony\Bundle\WebServerBundle\Command\ServerRunCommand">
11-
<argument>%kernel.root_dir%/../web</argument>
11+
<argument>%kernel.project_dir%/web</argument>
1212
<argument>%kernel.environment%</argument>
1313
<tag name="console.command" />
1414
</service>
1515

1616
<service id="web_server.command.server_start" class="Symfony\Bundle\WebServerBundle\Command\ServerStartCommand">
17-
<argument>%kernel.root_dir%/../web</argument>
17+
<argument>%kernel.project_dir%/web</argument>
1818
<argument>%kernel.environment%</argument>
1919
<tag name="console.command" />
2020
</service>

src/Symfony/Bundle/WebServerBundle/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"require": {
1919
"php": ">=5.5.9",
2020
"symfony/console": "~2.8.8|~3.0.8|~3.1.2|~3.2",
21-
"symfony/http-kernel": "~2.8|~3.0",
21+
"symfony/http-kernel": "~3.3",
2222
"symfony/process": "~2.8|~3.0"
2323
},
2424
"autoload": {

0 commit comments

Comments
 (0)