minor #22843 use getProjectDir() when possible (xabbuh)
This PR was merged into the 3.3 branch.
Discussion
----------
use getProjectDir() when possible
| Q | A
| ------------- | ---
| Branch? | 3.3
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | continues #22315
| License | MIT
| Doc PR |
Commits
-------
a8e298a66c
use getProjectDir() when possible
This commit is contained in:
commit
222325f088
@ -46,7 +46,6 @@ class AboutCommand extends ContainerAwareCommand
|
||||
|
||||
/** @var $kernel KernelInterface */
|
||||
$kernel = $this->getContainer()->get('kernel');
|
||||
$baseDir = realpath($kernel->getRootDir().DIRECTORY_SEPARATOR.'..');
|
||||
|
||||
$io->table(array(), array(
|
||||
array('<info>Symfony</>'),
|
||||
@ -62,9 +61,9 @@ class AboutCommand extends ContainerAwareCommand
|
||||
array('Environment', $kernel->getEnvironment()),
|
||||
array('Debug', $kernel->isDebug() ? 'true' : 'false'),
|
||||
array('Charset', $kernel->getCharset()),
|
||||
array('Root directory', self::formatPath($kernel->getRootDir(), $baseDir)),
|
||||
array('Cache directory', self::formatPath($kernel->getCacheDir(), $baseDir).' (<comment>'.self::formatFileSize($kernel->getCacheDir()).'</>)'),
|
||||
array('Log directory', self::formatPath($kernel->getLogDir(), $baseDir).' (<comment>'.self::formatFileSize($kernel->getLogDir()).'</>)'),
|
||||
array('Root directory', self::formatPath($kernel->getRootDir(), $kernel->getProjectDir())),
|
||||
array('Cache directory', self::formatPath($kernel->getCacheDir(), $kernel->getProjectDir()).' (<comment>'.self::formatFileSize($kernel->getCacheDir()).'</>)'),
|
||||
array('Log directory', self::formatPath($kernel->getLogDir(), $kernel->getProjectDir()).' (<comment>'.self::formatFileSize($kernel->getLogDir()).'</>)'),
|
||||
new TableSeparator(),
|
||||
array('<info>PHP</>'),
|
||||
new TableSeparator(),
|
||||
|
@ -82,9 +82,7 @@ EOT
|
||||
$targetArg = rtrim($input->getArgument('target'), '/');
|
||||
|
||||
if (!is_dir($targetArg)) {
|
||||
$appRoot = $this->getContainer()->getParameter('kernel.root_dir').'/..';
|
||||
|
||||
$targetArg = $appRoot.'/'.$targetArg;
|
||||
$targetArg = $this->getContainer()->getParameter('kernel.project_dir').'/'.$targetArg;
|
||||
|
||||
if (!is_dir($targetArg)) {
|
||||
throw new \InvalidArgumentException(sprintf('The target directory "%s" does not exist.', $input->getArgument('target')));
|
||||
|
@ -8,13 +8,13 @@
|
||||
<defaults public="false" />
|
||||
|
||||
<service id="web_server.command.server_run" class="Symfony\Bundle\WebServerBundle\Command\ServerRunCommand">
|
||||
<argument>%kernel.root_dir%/../web</argument>
|
||||
<argument>%kernel.project_dir%/web</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.root_dir%/../web</argument>
|
||||
<argument>%kernel.project_dir%/web</argument>
|
||||
<argument>%kernel.environment%</argument>
|
||||
<tag name="console.command" />
|
||||
</service>
|
||||
|
@ -18,7 +18,7 @@
|
||||
"require": {
|
||||
"php": ">=5.5.9",
|
||||
"symfony/console": "~2.8.8|~3.0.8|~3.1.2|~3.2",
|
||||
"symfony/http-kernel": "~2.8|~3.0",
|
||||
"symfony/http-kernel": "~3.3",
|
||||
"symfony/process": "~2.8|~3.0"
|
||||
},
|
||||
"autoload": {
|
||||
|
Reference in New Issue
Block a user