[*Bundle] Replace some kernel.root_dir by kernel.project_dir
This commit is contained in:
parent
7a70077bec
commit
4add28b518
@ -56,6 +56,7 @@
|
||||
<argument>%kernel.root_dir%/Resources</argument>
|
||||
<argument type="collection">
|
||||
<argument>%kernel.root_dir%</argument>
|
||||
<argument>%kernel.project_dir%</argument>
|
||||
</argument>
|
||||
</service>
|
||||
<service id="Symfony\Component\HttpKernel\Config\FileLocator" alias="file_locator" />
|
||||
|
@ -31,7 +31,7 @@ class CodeHelper extends Helper
|
||||
public function __construct($fileLinkFormat, $rootDir, $charset)
|
||||
{
|
||||
$this->fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format');
|
||||
$this->rootDir = str_replace('\\', '/', $rootDir).'/';
|
||||
$this->rootDir = str_replace('\\', '/', dirname($rootDir)).'/';
|
||||
$this->charset = $charset;
|
||||
}
|
||||
|
||||
|
@ -53,24 +53,6 @@ class WebProfilerExtension extends Extension
|
||||
$container->setParameter('web_profiler.debug_toolbar.intercept_redirects', $config['intercept_redirects']);
|
||||
$container->setParameter('web_profiler.debug_toolbar.mode', $config['toolbar'] ? WebDebugToolbarListener::ENABLED : WebDebugToolbarListener::DISABLED);
|
||||
}
|
||||
|
||||
$baseDir = array();
|
||||
$rootDir = $container->getParameter('kernel.root_dir');
|
||||
$rootDir = explode(DIRECTORY_SEPARATOR, realpath($rootDir) ?: $rootDir);
|
||||
$bundleDir = explode(DIRECTORY_SEPARATOR, __DIR__);
|
||||
for ($i = 0; isset($rootDir[$i], $bundleDir[$i]); ++$i) {
|
||||
if ($rootDir[$i] !== $bundleDir[$i]) {
|
||||
break;
|
||||
}
|
||||
$baseDir[] = $rootDir[$i];
|
||||
}
|
||||
$baseDir = implode(DIRECTORY_SEPARATOR, $baseDir);
|
||||
|
||||
$profilerController = $container->getDefinition('web_profiler.controller.profiler');
|
||||
$profilerController->replaceArgument(6, $baseDir);
|
||||
|
||||
$fileLinkFormatter = $container->getDefinition('debug.file_link_formatter');
|
||||
$fileLinkFormatter->replaceArgument(2, $baseDir);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -14,7 +14,7 @@
|
||||
<argument>%data_collector.templates%</argument>
|
||||
<argument>%web_profiler.debug_toolbar.position%</argument>
|
||||
<argument type="service" id="web_profiler.csp.handler" />
|
||||
<argument>null</argument>
|
||||
<argument>%kernel.project_dir%</argument>
|
||||
</service>
|
||||
|
||||
<service id="web_profiler.controller.router" class="Symfony\Bundle\WebProfilerBundle\Controller\RouterController" public="true">
|
||||
@ -55,7 +55,7 @@
|
||||
<service id="debug.file_link_formatter" class="Symfony\Component\HttpKernel\Debug\FileLinkFormatter">
|
||||
<argument>%debug.file_link_format%</argument>
|
||||
<argument type="service" id="request_stack" on-invalid="ignore" />
|
||||
<argument>null</argument>
|
||||
<argument>%kernel.project_dir%</argument>
|
||||
<argument>/_profiler/open?file=%%f&line=%%l#line%%l</argument>
|
||||
</service>
|
||||
</services>
|
||||
|
@ -60,6 +60,7 @@ class WebProfilerExtensionTest extends TestCase
|
||||
$this->container->setParameter('kernel.bundles', array());
|
||||
$this->container->setParameter('kernel.cache_dir', __DIR__);
|
||||
$this->container->setParameter('kernel.debug', false);
|
||||
$this->container->setParameter('kernel.project_dir', __DIR__);
|
||||
$this->container->setParameter('kernel.root_dir', __DIR__);
|
||||
$this->container->setParameter('kernel.charset', 'UTF-8');
|
||||
$this->container->setParameter('debug.file_link_format', null);
|
||||
|
@ -17,7 +17,7 @@
|
||||
],
|
||||
"require": {
|
||||
"php": "^5.5.9|>=7.0.8",
|
||||
"symfony/http-kernel": "~3.2|~4.0",
|
||||
"symfony/http-kernel": "~3.3|~4.0",
|
||||
"symfony/polyfill-php70": "~1.0",
|
||||
"symfony/routing": "~2.8|~3.0|~4.0",
|
||||
"symfony/twig-bridge": "~2.8|~3.0|~4.0",
|
||||
|
Reference in New Issue
Block a user