From 8e820561295b28366becfddce274d7e52cf37f2a Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 22 Jan 2025 14:48:49 +0100 Subject: [PATCH] [Cache] Don't clear system caches on cache:clear --- .../Tests/Functional/CachePoolsTest.php | 4 ---- .../Functional/ContainerDebugCommandTest.php | 20 +++++++++++-------- .../Functional/app/CachePools/default.yml | 5 ----- .../DependencyInjection/CachePoolPass.php | 4 ---- 4 files changed, 12 insertions(+), 21 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolsTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolsTest.php index 2608966586a78..23f4a116ef341 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolsTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolsTest.php @@ -88,10 +88,6 @@ private function doTestCachePools($options, $adapterClass) $pool2 = $container->get('cache.pool2'); $pool2->save($item); - $container->get('cache_clearer.alias')->clear($container->getParameter('kernel.cache_dir')); - $item = $pool1->getItem($key); - $this->assertFalse($item->isHit()); - $item = $pool2->getItem($key); $this->assertTrue($item->isHit()); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ContainerDebugCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ContainerDebugCommandTest.php index 1adddd1832500..24c6faf332525 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ContainerDebugCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ContainerDebugCommandTest.php @@ -139,14 +139,18 @@ public function testTagsPartialSearch() $tester->setInputs(['0']); $tester->run(['command' => 'debug:container', '--tag' => 'kernel.'], ['decorated' => false]); - $this->assertStringContainsString('Select one of the following tags to display its information', $tester->getDisplay()); - $this->assertStringContainsString('[0] kernel.cache_clearer', $tester->getDisplay()); - $this->assertStringContainsString('[1] kernel.cache_warmer', $tester->getDisplay()); - $this->assertStringContainsString('[2] kernel.event_subscriber', $tester->getDisplay()); - $this->assertStringContainsString('[3] kernel.fragment_renderer', $tester->getDisplay()); - $this->assertStringContainsString('[4] kernel.locale_aware', $tester->getDisplay()); - $this->assertStringContainsString('[5] kernel.reset', $tester->getDisplay()); - $this->assertStringContainsString('Symfony Container Services Tagged with "kernel.cache_clearer" Tag', $tester->getDisplay()); + $this->assertStringMatchesFormat(<<getDisplay() + ); } public function testDescribeEnvVars() diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/CachePools/default.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/CachePools/default.yml index c03efedd02bf7..377d3e7852064 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/CachePools/default.yml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/CachePools/default.yml @@ -1,7 +1,2 @@ imports: - { resource: ../config/default.yml } - -services: - cache_clearer.alias: - alias: cache_clearer - public: true diff --git a/src/Symfony/Component/Cache/DependencyInjection/CachePoolPass.php b/src/Symfony/Component/Cache/DependencyInjection/CachePoolPass.php index f6622f27bdc19..90c089074ef4b 100644 --- a/src/Symfony/Component/Cache/DependencyInjection/CachePoolPass.php +++ b/src/Symfony/Component/Cache/DependencyInjection/CachePoolPass.php @@ -197,10 +197,6 @@ public function process(ContainerBuilder $container) $clearer->setArgument(0, $pools); } $clearer->addTag('cache.pool.clearer'); - - if ('cache.system_clearer' === $id) { - $clearer->addTag('kernel.cache_clearer'); - } } $allPoolsKeys = array_keys($allPools);