Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9afa586

Browse filesBrowse files
[FrameworkBundle] Dont rely on any parent definition for "cache.annotations"
1 parent 59f9949 commit 9afa586
Copy full SHA for 9afa586

File tree

4 files changed

+28
-4
lines changed
Filter options

4 files changed

+28
-4
lines changed

‎src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CachePoolClearerPass.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CachePoolClearerPass.php
+18Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler;
1313

14+
use Symfony\Component\Cache\Adapter\AbstractAdapter;
1415
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
1516
use Symfony\Component\DependencyInjection\ContainerBuilder;
1617
use Symfony\Component\DependencyInjection\Reference;
@@ -36,5 +37,22 @@ public function process(ContainerBuilder $container)
3637
}
3738
}
3839
}
40+
41+
if (!$container->has('cache.annotations')) {
42+
return;
43+
}
44+
$factory = array(AbstractAdapter::class, 'createSystemCache');
45+
$annotationsPool = $container->getDefinition('cache.annotations');
46+
if ($factory !== $annotationsPool->getFactory() || 4 !== count($annotationsPool->getArguments())) {
47+
return;
48+
}
49+
if ($container->has('monolog.logger.cache')) {
50+
$annotationsPool->addArgument(new Reference('monolog.logger.cache'));
51+
} elseif ($container->has('cache.system')) {
52+
$systemPool = $container->getDefinition('cache.system');
53+
if ($factory === $systemPool->getFactory() && 5 === count($systemArgs = $systemPool->getArguments())) {
54+
$annotationsPool->addArgument($systemArgs[4]);
55+
}
56+
}
3957
}
4058
}

‎src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,6 +1238,7 @@ private function registerPropertyInfoConfiguration(array $config, ContainerBuild
12381238
private function registerCacheConfiguration(array $config, ContainerBuilder $container)
12391239
{
12401240
$version = substr(str_replace('/', '-', base64_encode(hash('sha256', uniqid(mt_rand(), true), true))), 0, 22);
1241+
$container->getDefinition('cache.annotations')->replaceArgument(2, $version);
12411242
$container->getDefinition('cache.adapter.apcu')->replaceArgument(2, $version);
12421243
$container->getDefinition('cache.adapter.system')->replaceArgument(2, $version);
12431244
$container->getDefinition('cache.adapter.filesystem')->replaceArgument(2, $config['directory']);

‎src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,12 @@ public function build(ContainerBuilder $container)
9393
$container->addCompilerPass(new SerializerPass());
9494
$container->addCompilerPass(new PropertyInfoPass());
9595
$container->addCompilerPass(new ControllerArgumentValueResolverPass());
96-
$container->addCompilerPass(new CachePoolPass());
96+
$container->addCompilerPass(new CachePoolPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, 32);
9797
$container->addCompilerPass(new ValidateWorkflowsPass());
9898
$container->addCompilerPass(new CachePoolClearerPass(), PassConfig::TYPE_AFTER_REMOVING);
9999

100100
if ($container->getParameter('kernel.debug')) {
101-
$container->addCompilerPass(new AddDebugLogProcessorPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, -1);
101+
$container->addCompilerPass(new AddDebugLogProcessorPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, -32);
102102
$container->addCompilerPass(new UnusedTagsPass(), PassConfig::TYPE_AFTER_REMOVING);
103103
$container->addCompilerPass(new ContainerBuilderDebugDumpPass(), PassConfig::TYPE_AFTER_REMOVING);
104104
$container->addCompilerPass(new CompilerDebugDumpPass(), PassConfig::TYPE_AFTER_REMOVING);

‎src/Symfony/Bundle/FrameworkBundle/Resources/config/cache.xml

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Resources/config/cache.xml
+7-2Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,13 @@
2222
<tag name="cache.pool" />
2323
</service>
2424

25-
<service id="cache.annotations" parent="cache.system" public="false">
26-
<tag name="cache.pool" />
25+
<service id="cache.annotations" class="Symfony\Component\Cache\Adapter\AdapterInterface" public="false">
26+
<factory class="Symfony\Component\Cache\Adapter\AbstractAdapter" method="createSystemCache" />
27+
<tag name="cache.pool" clearer="cache.default_clearer" />
28+
<argument /> <!-- namespace -->
29+
<argument>0</argument> <!-- default lifetime -->
30+
<argument /> <!-- version -->
31+
<argument>%kernel.cache_dir%/pools</argument>
2732
</service>
2833

2934
<service id="cache.adapter.system" class="Symfony\Component\Cache\Adapter\AdapterInterface" abstract="true">

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.