minor #37199 [FrameworkBundle] Move profiling configuration to PHP (hvt)
This PR was merged into the 5.2-dev branch.
Discussion
----------
[FrameworkBundle] Move profiling configuration to PHP
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets | #37186
| License | MIT
Moving profiling configuration in framework bundle to PHP.
Commits
-------
20b5d245c7
[FrameworkBundle] Move profiling configuration to PHP
This commit is contained in:
commit
afed5eaefd
@ -369,7 +369,7 @@ class FrameworkExtension extends Extension
|
||||
$this->registerSsiConfiguration($config['ssi'], $container, $phpLoader);
|
||||
$this->registerFragmentsConfiguration($config['fragments'], $container, $loader);
|
||||
$this->registerTranslatorConfiguration($config['translator'], $container, $loader, $config['default_locale']);
|
||||
$this->registerProfilerConfiguration($config['profiler'], $container, $loader);
|
||||
$this->registerProfilerConfiguration($config['profiler'], $container, $loader, $phpLoader);
|
||||
$this->registerWorkflowConfiguration($config['workflows'], $container, $loader);
|
||||
$this->registerDebugConfiguration($config['php_errors'], $container, $phpLoader);
|
||||
$this->registerRouterConfiguration($config['router'], $container, $loader, $config['translator']['enabled_locales'] ?? []);
|
||||
@ -568,7 +568,7 @@ class FrameworkExtension extends Extension
|
||||
$container->setParameter('fragment.path', $config['path']);
|
||||
}
|
||||
|
||||
private function registerProfilerConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader)
|
||||
private function registerProfilerConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader, PhpFileLoader $phpLoader)
|
||||
{
|
||||
if (!$this->isConfigEnabled($container, $config)) {
|
||||
// this is needed for the WebProfiler to work even if the profiler is disabled
|
||||
@ -577,7 +577,7 @@ class FrameworkExtension extends Extension
|
||||
return;
|
||||
}
|
||||
|
||||
$loader->load('profiling.xml');
|
||||
$phpLoader->load('profiling.php');
|
||||
$loader->load('collectors.xml');
|
||||
$loader->load('cache_debug.xml');
|
||||
|
||||
|
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
|
||||
|
||||
use Symfony\Component\HttpKernel\EventListener\ProfilerListener;
|
||||
use Symfony\Component\HttpKernel\Profiler\FileProfilerStorage;
|
||||
use Symfony\Component\HttpKernel\Profiler\Profiler;
|
||||
|
||||
return static function (ContainerConfigurator $container) {
|
||||
$container->services()
|
||||
->set('profiler', Profiler::class)
|
||||
->public()
|
||||
->args([service('profiler.storage'), service('logger')->nullOnInvalid()])
|
||||
->tag('monolog.logger', ['channel' => 'profiler'])
|
||||
|
||||
->set('profiler.storage', FileProfilerStorage::class)
|
||||
->args([param('profiler.storage.dsn')])
|
||||
|
||||
->set('profiler_listener', ProfilerListener::class)
|
||||
->args([
|
||||
service('profiler'),
|
||||
service('request_stack'),
|
||||
null,
|
||||
param('profiler_listener.only_exceptions'),
|
||||
param('profiler_listener.only_master_requests'),
|
||||
])
|
||||
->tag('kernel.event_subscriber')
|
||||
;
|
||||
};
|
@ -1,29 +0,0 @@
|
||||
<?xml version="1.0" ?>
|
||||
|
||||
<container xmlns="http://symfony.com/schema/dic/services"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd">
|
||||
|
||||
<services>
|
||||
<defaults public="false" />
|
||||
|
||||
<service id="profiler" class="Symfony\Component\HttpKernel\Profiler\Profiler" public="true">
|
||||
<tag name="monolog.logger" channel="profiler" />
|
||||
<argument type="service" id="profiler.storage" />
|
||||
<argument type="service" id="logger" on-invalid="null" />
|
||||
</service>
|
||||
|
||||
<service id="profiler.storage" class="Symfony\Component\HttpKernel\Profiler\FileProfilerStorage">
|
||||
<argument>%profiler.storage.dsn%</argument>
|
||||
</service>
|
||||
|
||||
<service id="profiler_listener" class="Symfony\Component\HttpKernel\EventListener\ProfilerListener">
|
||||
<tag name="kernel.event_subscriber" />
|
||||
<argument type="service" id="profiler" />
|
||||
<argument type="service" id="request_stack" />
|
||||
<argument>null</argument>
|
||||
<argument>%profiler_listener.only_exceptions%</argument>
|
||||
<argument>%profiler_listener.only_master_requests%</argument>
|
||||
</service>
|
||||
</services>
|
||||
</container>
|
Reference in New Issue
Block a user