Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit9a37ba4

Browse files
committed
bug#28805 Revert "feature#27549 [Cache] Unconditionally use PhpFilesAdapter for system pools" (nicolas-grekas)
This PR was merged into the 4.2-dev branch.Discussion----------Revert "feature#27549 [Cache] Unconditionally use PhpFilesAdapter for system pools"This reverts commitd4f5d46, reversingchanges made to7e3b7b0.| Q | A| ------------- | ---| Branch? | 4.2| Bug fix? | yes| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets | -| License | MIT| Doc PR | -Reading#28800, I've just realized that#27549 breaks using system caches with read-only filesystem.Using ApcuAdapter makes system caches compatible with read-only filesystems.Note that this affects only non-warmed up pools, as the warmed-up ones use a faster `PhpArrayAdapter` in front.Commits-------dbc1230 Revert "feature#27549 [Cache] Unconditionally use PhpFilesAdapter for system pools (nicolas-grekas)"
2 parents4d70a0b +dbc1230 commit9a37ba4

File tree

4 files changed

+12
-25
lines changed

4 files changed

+12
-25
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1601,6 +1601,7 @@ private function registerCacheConfiguration(array $config, ContainerBuilder $con
16011601

16021602
$version =newParameter('container.build_id');
16031603
$container->getDefinition('cache.adapter.apcu')->replaceArgument(2,$version);
1604+
$container->getDefinition('cache.adapter.system')->replaceArgument(2,$version);
16041605
$container->getDefinition('cache.adapter.filesystem')->replaceArgument(2,$config['directory']);
16051606

16061607
if (isset($config['prefix_seed'])) {

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,15 @@
3535
<tagname="cache.pool" />
3636
</service>
3737

38-
<serviceid="cache.adapter.system"class="Symfony\Component\Cache\Adapter\PhpFilesAdapter"abstract="true">
38+
<serviceid="cache.adapter.system"class="Symfony\Component\Cache\Adapter\AdapterInterface"abstract="true">
39+
<factoryclass="Symfony\Component\Cache\Adapter\AbstractAdapter"method="createSystemCache" />
3940
<tagname="cache.pool"clearer="cache.system_clearer" />
4041
<tagname="monolog.logger"channel="cache" />
4142
<argument /><!-- namespace-->
4243
<argument>0</argument><!-- default lifetime-->
44+
<argument /><!-- version-->
4345
<argument>%kernel.cache_dir%/pools</argument>
44-
<argument>true</argument>
45-
<callmethod="setLogger">
46-
<argumenttype="service"id="logger"on-invalid="ignore" />
47-
</call>
46+
<argumenttype="service"id="logger"on-invalid="ignore" />
4847
</service>
4948

5049
<serviceid="cache.adapter.apcu"class="Symfony\Component\Cache\Adapter\ApcuAdapter"abstract="true">

‎src/Symfony/Component/Cache/Adapter/AbstractAdapter.php‎

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -94,53 +94,41 @@ function ($deferred, $namespace, &$expiredIds) use ($getId) {
9494
}
9595

9696
/**
97+
* Returns an ApcuAdapter if supported, a PhpFilesAdapter otherwise.
98+
*
99+
* Using ApcuAdapter makes system caches compatible with read-only filesystems.
100+
*
97101
* @param string $namespace
98102
* @param int $defaultLifetime
99103
* @param string $version
100104
* @param string $directory
101105
* @param LoggerInterface|null $logger
102106
*
103107
* @return AdapterInterface
104-
*
105-
* @deprecated since Symfony 4.2
106108
*/
107109
publicstaticfunctioncreateSystemCache($namespace,$defaultLifetime,$version,$directory,LoggerInterface$logger =null)
108110
{
109-
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2.',__METHOD__),E_USER_DEPRECATED);
110-
111111
if (null ===self::$apcuSupported) {
112112
self::$apcuSupported = ApcuAdapter::isSupported();
113113
}
114114

115-
if (!self::$apcuSupported &&null ===self::$phpFilesSupported) {
116-
self::$phpFilesSupported = PhpFilesAdapter::isSupported();
117-
}
118-
119-
if (self::$phpFilesSupported) {
120-
$opcache =newPhpFilesAdapter($namespace,$defaultLifetime,$directory);
115+
if (!self::$apcuSupported) {
116+
$opcache =newPhpFilesAdapter($namespace,$defaultLifetime,$directory,true);
121117
if (null !==$logger) {
122118
$opcache->setLogger($logger);
123119
}
124120

125121
return$opcache;
126122
}
127123

128-
$fs =newFilesystemAdapter($namespace,$defaultLifetime,$directory);
129-
if (null !==$logger) {
130-
$fs->setLogger($logger);
131-
}
132-
if (!self::$apcuSupported) {
133-
return$fs;
134-
}
135-
136124
$apcu =newApcuAdapter($namespace, (int)$defaultLifetime /5,$version);
137125
if ('cli' === \PHP_SAPI && !ini_get('apc.enable_cli')) {
138126
$apcu->setLogger(newNullLogger());
139127
}elseif (null !==$logger) {
140128
$apcu->setLogger($logger);
141129
}
142130

143-
returnnewChainAdapter(array($apcu,$fs));
131+
return$apcu;
144132
}
145133

146134
publicstaticfunctioncreateConnection($dsn,array$options =array())

‎src/Symfony/Component/Cache/CHANGELOG.md‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ CHANGELOG
1212
* added automatic table creation when using Doctrine DBAL with PDO-based backends
1313
* throw`LogicException` when`CacheItem::tag()` is called on an item coming from a non tag-aware pool
1414
* deprecated`CacheItem::getPreviousTags()`, use`CacheItem::getMetadata()` instead
15-
* deprecated the`AbstractAdapter::createSystemCache()` method
1615
* deprecated the`AbstractAdapter::unserialize()` and`AbstractCache::unserialize()` methods
1716
* added`CacheCollectorPass` (originally in`FrameworkBundle`)
1817
* added`CachePoolClearerPass` (originally in`FrameworkBundle`)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp