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 0c8358b

Browse filesBrowse files
[Cache] Rename nonce to version
1 parent 7a4019b commit 0c8358b
Copy full SHA for 0c8358b

File tree

Expand file treeCollapse file tree

5 files changed

+13
-13
lines changed
Filter options
Expand file treeCollapse file tree

5 files changed

+13
-13
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,9 +1037,9 @@ private function registerPropertyInfoConfiguration(array $config, ContainerBuild
10371037

10381038
private function registerCacheConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader)
10391039
{
1040-
$nonce = substr(str_replace('/', '-', base64_encode(md5(uniqid(mt_rand(), true), true))), 0, -2);
1041-
$container->getDefinition('cache.adapter.apcu')->replaceArgument(2, $nonce);
1042-
$container->getDefinition('cache.adapter.system')->replaceArgument(2, $nonce);
1040+
$version = substr(str_replace('/', '-', base64_encode(md5(uniqid(mt_rand(), true), true))), 0, -2);
1041+
$container->getDefinition('cache.adapter.apcu')->replaceArgument(2, $version);
1042+
$container->getDefinition('cache.adapter.system')->replaceArgument(2, $version);
10431043
$container->getDefinition('cache.adapter.filesystem')->replaceArgument(2, $config['directory']);
10441044

10451045
foreach (array('doctrine', 'psr6', 'redis') as $name) {

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

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Resources/config/cache.xml
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<tag name="monolog.logger" channel="cache" />
2929
<argument /> <!-- namespace -->
3030
<argument /> <!-- default lifetime -->
31-
<argument /> <!-- nonce -->
31+
<argument /> <!-- version -->
3232
<argument>%kernel.cache_dir%/pools</argument>
3333
<argument type="service" id="logger" on-invalid="ignore" />
3434
</service>
@@ -38,7 +38,7 @@
3838
<tag name="monolog.logger" channel="cache" />
3939
<argument /> <!-- namespace -->
4040
<argument /> <!-- default lifetime -->
41-
<argument /> <!-- nonce -->
41+
<argument /> <!-- version -->
4242
<call method="setLogger">
4343
<argument type="service" id="logger" on-invalid="ignore" />
4444
</call>

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/Adapter/AbstractAdapter.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ function ($deferred, $namespace, &$expiredIds) {
6868
);
6969
}
7070

71-
public static function createSystemCache($namespace, $defaultLifetime, $nonce, $directory, LoggerInterface $logger = null)
71+
public static function createSystemCache($namespace, $defaultLifetime, $version, $directory, LoggerInterface $logger = null)
7272
{
7373
$fs = new FilesystemAdapter($namespace, $defaultLifetime, $directory);
7474
if (null !== $logger) {
@@ -78,7 +78,7 @@ public static function createSystemCache($namespace, $defaultLifetime, $nonce, $
7878
return $fs;
7979
}
8080

81-
$apcu = new ApcuAdapter($namespace, $defaultLifetime / 5, $nonce);
81+
$apcu = new ApcuAdapter($namespace, $defaultLifetime / 5, $version);
8282
if (null !== $logger) {
8383
$apcu->setLogger($logger);
8484
}

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/Adapter/ApcuAdapter.php
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public static function isSupported()
2424
return function_exists('apcu_fetch') && ini_get('apc.enabled') && !('cli' === PHP_SAPI && !ini_get('apc.enable_cli'));
2525
}
2626

27-
public function __construct($namespace = '', $defaultLifetime = 0, $nonce = null)
27+
public function __construct($namespace = '', $defaultLifetime = 0, $version = null)
2828
{
2929
if (!static::isSupported()) {
3030
throw new CacheException('APCu is not enabled');
@@ -34,12 +34,12 @@ public function __construct($namespace = '', $defaultLifetime = 0, $nonce = null
3434
}
3535
parent::__construct($namespace, $defaultLifetime);
3636

37-
if (null !== $nonce) {
38-
CacheItem::validateKey($nonce);
37+
if (null !== $version) {
38+
CacheItem::validateKey($version);
3939

40-
if (!apcu_exists($nonce.':nonce'.$namespace)) {
40+
if (!apcu_exists($version.':'.$namespace)) {
4141
$this->clear($namespace);
42-
apcu_add($nonce.':nonce'.$namespace, null);
42+
apcu_add($version.':'.$namespace, null);
4343
}
4444
}
4545
}

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/Tests/Adapter/ApcuAdapterTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function testUnserializable()
4444
$this->assertFalse($item->isHit());
4545
}
4646

47-
public function testNonce()
47+
public function testVersion()
4848
{
4949
$namespace = str_replace('\\', '.', __CLASS__);
5050

0 commit comments

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