Include ICU version in cache key for collation first letters
authorBrian Wolff <bawolff+wn@gmail.com>
Mon, 21 Jul 2014 22:25:36 +0000 (19:25 -0300)
committerBrian Wolff <bawolff+wn@gmail.com>
Wed, 23 Jul 2014 02:51:43 +0000 (23:51 -0300)
The cache key is only valid for specific versions of icu extension.
If you upgrade php, the cache key should get refreshed.

Note: Changing your version of icu (e.g. by upgrading php)
still requires updateCollation.php --force to be run. This
patch does nothing to change that.

Note: Have not tested on hhvm, which is what the original bug
report was about.

Bug: 68344
Change-Id: Ib5ac2adc34a5a120b916cebcf62ff3d6ee057403

includes/Collation.php

index 71adb09..9bb725f 100644 (file)
@@ -365,7 +365,12 @@ class IcuCollation extends Collation {
                }
 
                $cache = wfGetCache( CACHE_ANYTHING );
-               $cacheKey = wfMemcKey( 'first-letters', $this->locale, $this->digitTransformLanguage->getCode() );
+               $cacheKey = wfMemcKey(
+                       'first-letters',
+                       $this->locale,
+                       $this->digitTransformLanguage->getCode(),
+                       self::getICUVersion()
+               );
                $cacheEntry = $cache->get( $cacheKey );
 
                if ( $cacheEntry && isset( $cacheEntry['version'] )