From b0c04f83544ce397fb3f34e4b42f5ee21274ed65 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 26 Sep 2017 11:37:36 +0200 Subject: [PATCH] [FrameworkBundle] Don't clear app pools on cache:clear --- UPGRADE-3.4.md | 4 ++++ src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md | 2 ++ .../DependencyInjection/Compiler/CachePoolPass.php | 2 +- .../DependencyInjection/FrameworkExtension.php | 2 +- .../Bundle/FrameworkBundle/Resources/config/cache.xml | 6 +++++- .../FrameworkBundle/Tests/Functional/CachePoolsTest.php | 6 +++--- .../Tests/Functional/app/CachePools/config.yml | 1 + .../Tests/Functional/app/CachePools/redis_config.yml | 1 + .../Tests/Functional/app/CachePools/redis_custom_config.yml | 1 + 9 files changed, 19 insertions(+), 6 deletions(-) diff --git a/UPGRADE-3.4.md b/UPGRADE-3.4.md index 6561c15a0b46f..d5ae0a934ffa2 100644 --- a/UPGRADE-3.4.md +++ b/UPGRADE-3.4.md @@ -113,6 +113,10 @@ Form FrameworkBundle --------------- + * The `cache:clear` command doesn't clear "app" PSR-6 cache pools anymore, + but still clears "system" ones. + Use the `cache:pool:clear` command to clear "app" pools instead. + * The `doctrine/cache` dependency has been removed; require it via `composer require doctrine/cache` if you are using Doctrine cache in your project. diff --git a/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md b/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md index 34af26de698ed..f49eb6dbc2dd3 100644 --- a/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md +++ b/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md @@ -4,6 +4,8 @@ CHANGELOG 3.4.0 ----- + * Made the `cache:clear` command to *not* clear "app" PSR-6 cache pools anymore, + but to still clear "system" ones; use the `cache:pool:clear` command to clear "app" pools instead * Always register a minimalist logger that writes in `stderr` * Deprecated `profiler.matcher` option * Added support for `EventSubscriberInterface` on `MicroKernelTrait` diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CachePoolPass.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CachePoolPass.php index dafe0b7b8fce4..004a2c544da3d 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CachePoolPass.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CachePoolPass.php @@ -106,7 +106,7 @@ public function process(ContainerBuilder $container) foreach ($clearers as $id => $pools) { $clearer = $container->getDefinition($id); - if ($clearer instanceof ChilDefinition) { + if ($clearer instanceof ChildDefinition) { $clearer->replaceArgument(0, $pools); } else { $clearer->setArgument(0, $pools); diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index dafecf9d581d6..0e136bfe436f7 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -1802,7 +1802,7 @@ private function registerCacheConfiguration(array $config, ContainerBuilder $con if (!$container->getParameter('kernel.debug')) { $propertyAccessDefinition->setFactory(array(PropertyAccessor::class, 'createCache')); $propertyAccessDefinition->setArguments(array(null, null, $version, new Reference('logger', ContainerInterface::IGNORE_ON_INVALID_REFERENCE))); - $propertyAccessDefinition->addTag('cache.pool', array('clearer' => 'cache.default_clearer')); + $propertyAccessDefinition->addTag('cache.pool', array('clearer' => 'cache.system_clearer')); $propertyAccessDefinition->addTag('monolog.logger', array('channel' => 'cache')); } else { $propertyAccessDefinition->setClass(ArrayAdapter::class); diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/cache.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/cache.xml index 16b15a661768c..b4d23a576ed0f 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/cache.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/cache.xml @@ -29,7 +29,7 @@ - + 0 @@ -101,6 +101,10 @@ + + + + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolsTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolsTest.php index 06ed75d64d5c1..eafc798a4838b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolsTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolsTest.php @@ -11,7 +11,7 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\Functional; -use Symfony\Component\Cache\Adapter\FilesystemAdapter; +use Symfony\Component\Cache\Adapter\AdapterInterface; use Symfony\Component\Cache\Adapter\RedisAdapter; use Symfony\Component\Cache\Exception\InvalidArgumentException; @@ -19,7 +19,7 @@ class CachePoolsTest extends WebTestCase { public function testCachePools() { - $this->doTestCachePools(array(), FilesystemAdapter::class); + $this->doTestCachePools(array(), AdapterInterface::class); } /** @@ -67,7 +67,7 @@ public function testRedisCustomCachePools() } } - public function doTestCachePools($options, $adapterClass) + private function doTestCachePools($options, $adapterClass) { static::bootKernel($options); $container = static::$kernel->getContainer(); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/CachePools/config.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/CachePools/config.yml index eabf83825e05d..de1e144dad062 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/CachePools/config.yml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/CachePools/config.yml @@ -6,6 +6,7 @@ framework: pools: cache.pool1: public: true + adapter: cache.system cache.pool2: public: true adapter: cache.pool3 diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/CachePools/redis_config.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/CachePools/redis_config.yml index 02de40c5b81e5..3bf10f448f9c2 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/CachePools/redis_config.yml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/CachePools/redis_config.yml @@ -11,6 +11,7 @@ framework: pools: cache.pool1: public: true + clearer: cache.system_clearer cache.pool2: public: true clearer: ~ diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/CachePools/redis_custom_config.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/CachePools/redis_custom_config.yml index 9206638495947..d0a219753eb8e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/CachePools/redis_custom_config.yml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/CachePools/redis_custom_config.yml @@ -22,6 +22,7 @@ framework: pools: cache.pool1: public: true + clearer: cache.system_clearer cache.pool2: public: true clearer: ~ pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy