From 5a4d6673695e5fd7862886c5a5dd633a52ee53b6 Mon Sep 17 00:00:00 2001 From: 50bhan Date: Thu, 11 Jun 2020 14:16:59 +0430 Subject: [PATCH] [Ssi] Move configuration to PHP --- .../FrameworkExtension.php | 6 ++--- .../FrameworkBundle/Resources/config/ssi.php | 25 +++++++++++++++++++ .../FrameworkBundle/Resources/config/ssi.xml | 17 ------------- 3 files changed, 28 insertions(+), 20 deletions(-) create mode 100644 src/Symfony/Bundle/FrameworkBundle/Resources/config/ssi.php delete mode 100644 src/Symfony/Bundle/FrameworkBundle/Resources/config/ssi.xml diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index c1e838f79b..efc4371418 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -366,7 +366,7 @@ class FrameworkExtension extends Extension $propertyInfoEnabled = $this->isConfigEnabled($container, $config['property_info']); $this->registerValidationConfiguration($config['validation'], $container, $loader, $propertyInfoEnabled); $this->registerEsiConfiguration($config['esi'], $container, $loader); - $this->registerSsiConfiguration($config['ssi'], $container, $loader); + $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); @@ -543,7 +543,7 @@ class FrameworkExtension extends Extension $loader->load('esi.xml'); } - private function registerSsiConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader) + private function registerSsiConfiguration(array $config, ContainerBuilder $container, PhpFileLoader $loader) { if (!$this->isConfigEnabled($container, $config)) { $container->removeDefinition('fragment.renderer.ssi'); @@ -551,7 +551,7 @@ class FrameworkExtension extends Extension return; } - $loader->load('ssi.xml'); + $loader->load('ssi.php'); } private function registerFragmentsConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader) diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/ssi.php b/src/Symfony/Bundle/FrameworkBundle/Resources/config/ssi.php new file mode 100644 index 0000000000..d41aa74d1e --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/ssi.php @@ -0,0 +1,25 @@ + + * + * 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\SurrogateListener; +use Symfony\Component\HttpKernel\HttpCache\Ssi; + +return static function (ContainerConfigurator $container) { + $container->services() + ->set('ssi', Ssi::class) + + ->set('ssi_listener', SurrogateListener::class) + ->args([service('ssi')->ignoreOnInvalid()]) + ->tag('kernel.event_subscriber') + ; +}; diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/ssi.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/ssi.xml deleted file mode 100644 index b4e5b3d3df..0000000000 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/ssi.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - -