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 610d8fc

Browse filesBrowse files
[FrameworkBundle] Add default pool & system adapter
1 parent 714b916 commit 610d8fc
Copy full SHA for 610d8fc

File tree

6 files changed

+26
-9
lines changed
Filter options

6 files changed

+26
-9
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,7 @@ private function addCacheSection(ArrayNodeDefinition $rootNode)
555555
->children()
556556
->arrayNode('cache')
557557
->info('Cache configuration')
558+
->addDefaultsIfNotSet()
558559
->fixXmlConfig('pool')
559560
->children()
560561
->arrayNode('pools')

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

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
+16-7Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ public function load(array $configs, ContainerBuilder $container)
122122
$this->registerFragmentsConfiguration($config['fragments'], $container, $loader);
123123
$this->registerTranslatorConfiguration($config['translator'], $container);
124124
$this->registerProfilerConfiguration($config['profiler'], $container, $loader);
125+
$this->registerCacheConfiguration($config['cache'], $container, $loader);
125126

126127
if ($this->isConfigEnabled($container, $config['router'])) {
127128
$this->registerRouterConfiguration($config['router'], $container, $loader);
@@ -138,10 +139,6 @@ public function load(array $configs, ContainerBuilder $container)
138139
$this->registerPropertyInfoConfiguration($config['property_info'], $container, $loader);
139140
}
140141

141-
if (isset($config['cache'])) {
142-
$this->registerCacheConfiguration($config['cache'], $container, $loader);
143-
}
144-
145142
$loader->load('debug_prod.xml');
146143
$definition = $container->findDefinition('debug.debug_handlers_listener');
147144

@@ -1022,9 +1019,7 @@ private function registerPropertyInfoConfiguration(array $config, ContainerBuild
10221019

10231020
private function registerCacheConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader)
10241021
{
1025-
if (!empty($config['pools'])) {
1026-
$loader->load('cache_pools.xml');
1027-
}
1022+
$loader->load('cache_pools.xml');
10281023

10291024
foreach ($config['pools'] as $name => $poolConfig) {
10301025
$poolDefinition = new DefinitionDecorator($poolConfig['adapter']);
@@ -1034,6 +1029,20 @@ private function registerCacheConfiguration(array $config, ContainerBuilder $con
10341029
$poolDefinition->addTag('cache.pool', $poolConfig);
10351030
$container->setDefinition('cache.pool.'.$name, $poolDefinition);
10361031
}
1032+
1033+
$this->addClassesToCompile(array(
1034+
'Psr\Cache\CacheItemInterface',
1035+
'Psr\Cache\CacheItemPoolInterface',
1036+
'Symfony\Component\Cache\Adapter\AdapterInterface',
1037+
'Symfony\Component\Cache\Adapter\AbstractAdapter',
1038+
'Symfony\Component\Cache\CacheItem',
1039+
));
1040+
1041+
if (function_exists('apcu_fetch')) {
1042+
$this->addClassesToCompile(array('Symfony\Component\Cache\Adapter\ApcuAdapter'));
1043+
} else {
1044+
$container->setAlias('cache.adapter.system', 'cache.adapter.default');
1045+
}
10371046
}
10381047

10391048
/**

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

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Resources/config/cache_pools.xml
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111
</service>
1212

1313
<service id="cache.adapter.default" alias="cache.adapter.filesystem" />
14+
<service id="cache.adapter.system" alias="cache.adapter.apcu" />
15+
16+
<service id="cache.pool.default" parent="cache.adapter.default">
17+
<tag name="cache.pool" clearer="cache.default_pools_clearer" />
18+
</service>
1419

1520
<service id="cache.adapter.apcu" class="Symfony\Component\Cache\Adapter\ApcuAdapter" abstract="true">
1621
<argument /> <!-- namespace -->

‎src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,6 @@
216216
<xsd:attribute name="public" type="xsd:boolean" />
217217
<xsd:attribute name="default-lifetime" type="xsd:integer" />
218218
<xsd:attribute name="provider" type="xsd:string" />
219-
<xsd:attribute name="directory" type="xsd:string" />
220219
<xsd:attribute name="clearer" type="xsd:string" />
221220
</xsd:complexType>
222221
</xsd:schema>

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,9 @@ protected static function getBundleDefaultConfig()
265265
'base_urls' => array(),
266266
'packages' => array(),
267267
),
268+
'cache' => array(
269+
'pools' => array(),
270+
),
268271
);
269272
}
270273
}

‎src/Symfony/Bundle/FrameworkBundle/composer.json

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/composer.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"require": {
1919
"php": ">=5.5.9",
2020
"symfony/asset": "~2.8|~3.0",
21+
"symfony/cache": "~3.1",
2122
"symfony/class-loader": "~2.8|~3.0",
2223
"symfony/dependency-injection": "~3.1",
2324
"symfony/config": "~2.8|~3.0",
@@ -38,7 +39,6 @@
3839
},
3940
"require-dev": {
4041
"symfony/browser-kit": "~2.8|~3.0",
41-
"symfony/cache": "~3.1",
4242
"symfony/console": "~2.8|~3.0",
4343
"symfony/css-selector": "~2.8|~3.0",
4444
"symfony/dom-crawler": "~2.8|~3.0",

0 commit comments

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