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

Commitce1a15d

Browse files
[Cache] Unconditionally use PhpFilesAdapter for system pools
1 parent1b2bd8f commitce1a15d

File tree

15 files changed

+51
-58
lines changed

15 files changed

+51
-58
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1538,7 +1538,6 @@ private function registerCacheConfiguration(array $config, ContainerBuilder $con
15381538
{
15391539
$version =newParameter('container.build_id');
15401540
$container->getDefinition('cache.adapter.apcu')->replaceArgument(2,$version);
1541-
$container->getDefinition('cache.adapter.system')->replaceArgument(2,$version);
15421541
$container->getDefinition('cache.adapter.filesystem')->replaceArgument(2,$config['directory']);
15431542

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

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

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

38-
<serviceid="cache.adapter.system"class="Symfony\Component\Cache\Adapter\AdapterInterface"abstract="true">
39-
<factoryclass="Symfony\Component\Cache\Adapter\AbstractAdapter"method="createSystemCache" />
38+
<serviceid="cache.adapter.system"class="Symfony\Component\Cache\Adapter\PhpFilesAdapter"abstract="true">
4039
<tagname="cache.pool"clearer="cache.system_clearer" />
4140
<tagname="monolog.logger"channel="cache" />
4241
<argument /><!-- namespace-->
4342
<argument>0</argument><!-- default lifetime-->
44-
<argument /><!-- version-->
4543
<argument>%kernel.cache_dir%/pools</argument>
46-
<argumenttype="service"id="logger"on-invalid="ignore" />
44+
<callmethod="setLogger">
45+
<argumenttype="service"id="logger"on-invalid="ignore" />
46+
</call>
4747
</service>
4848

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

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,13 @@ function ($deferred, $namespace, &$expiredIds) use ($getId) {
8787
* @param LoggerInterface|null $logger
8888
*
8989
* @return AdapterInterface
90+
*
91+
* @deprecated since Symfony 4.2.
9092
*/
9193
publicstaticfunctioncreateSystemCache($namespace,$defaultLifetime,$version,$directory,LoggerInterface$logger =null)
9294
{
95+
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2.',__CLASS__),E_USER_DEPRECATED);
96+
9397
if (null ===self::$apcuSupported) {
9498
self::$apcuSupported = ApcuAdapter::isSupported();
9599
}

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ public function __construct(string $file, AdapterInterface $fallbackPool)
4343
{
4444
$this->file =$file;
4545
$this->pool =$fallbackPool;
46-
$this->zendDetectUnicode =ini_get('zend.detect_unicode');
4746
$this->createCacheItem = \Closure::bind(
4847
function ($key,$value,$isHit) {
4948
$item =newCacheItem();

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,11 @@ class PhpFilesAdapter extends AbstractAdapter implements PruneableInterface
2424
*/
2525
publicfunction__construct(string$namespace ='',int$defaultLifetime =0,string$directory =null)
2626
{
27-
if (!static::isSupported()) {
28-
thrownewCacheException('OPcache is not enabled');
29-
}
27+
self::$startTime =self::$startTime ??$_SERVER['REQUEST_TIME'] ??time();
3028
parent::__construct('',$defaultLifetime);
3129
$this->init($namespace,$directory);
3230

3331
$e =new \Exception();
3432
$this->includeHandler =function ()use ($e) {throw$e; };
35-
$this->zendDetectUnicode =ini_get('zend.detect_unicode');
3633
}
3734
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ CHANGELOG
66

77
* added`CacheInterface`, which should become the preferred way to use a cache
88
* throw`LogicException` when`CacheItem::tag()` is called on an item coming from a non tag-aware pool
9+
* deprecated the`AbstractAdapter::createSystemCache()` method
910

1011
3.4.0
1112
-----

‎src/Symfony/Component/Cache/Simple/PhpArrayCache.php‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ public function __construct(string $file, CacheInterface $fallbackPool)
3636
{
3737
$this->file =$file;
3838
$this->pool =$fallbackPool;
39-
$this->zendDetectUnicode =ini_get('zend.detect_unicode');
4039
}
4140

4241
/**

‎src/Symfony/Component/Cache/Simple/PhpFilesCache.php‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,11 @@ class PhpFilesCache extends AbstractCache implements PruneableInterface
2424
*/
2525
publicfunction__construct(string$namespace ='',int$defaultLifetime =0,string$directory =null)
2626
{
27-
if (!static::isSupported()) {
28-
thrownewCacheException('OPcache is not enabled');
29-
}
27+
self::$startTime =self::$startTime ??$_SERVER['REQUEST_TIME'] ??time();
3028
parent::__construct('',$defaultLifetime);
3129
$this->init($namespace,$directory);
3230

3331
$e =new \Exception();
3432
$this->includeHandler =function ()use ($e) {throw$e; };
35-
$this->zendDetectUnicode =ini_get('zend.detect_unicode');
3633
}
3734
}

‎src/Symfony/Component/Cache/Tests/Adapter/MaxIdLengthAdapterTest.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function testLongKey()
2626
$cache->expects($this->exactly(2))
2727
->method('doHave')
2828
->withConsecutive(
29-
array($this->equalTo('----------:0GTYWa9n4ed8vqNlOT2iEr:')),
29+
array($this->equalTo('----------:nWfzGiCgLczv3SSUzXL3kg:')),
3030
array($this->equalTo('----------:---------------------------------------'))
3131
);
3232

‎src/Symfony/Component/Cache/Tests/Adapter/PhpFilesAdapterTest.php‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@ class PhpFilesAdapterTest extends AdapterTestCase
2525

2626
publicfunctioncreateCachePool()
2727
{
28-
if (!PhpFilesAdapter::isSupported()) {
29-
$this->markTestSkipped('OPcache extension is not enabled.');
30-
}
31-
3228
returnnewPhpFilesAdapter('sf-cache');
3329
}
3430

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp