From: Tim Starling Date: Wed, 13 Mar 2013 03:53:20 +0000 (+1100) Subject: Allow first letter data to be invalidated X-Git-Tag: 1.31.0-rc.0~20363^2 X-Git-Url: http://git.cyclocoop.org/%22.%24match%5B1%5D.%22?a=commitdiff_plain;h=029dcc995328bd1cff8e27b1df96c9c1b63ae5d2;p=lhc%2Fweb%2Fwiklou.git Allow first letter data to be invalidated Just a class constant for now, but that should suffice to deal with the current emergency. Proper dependency tracking via the CacheDependency hierarchy would be pretty cool in the long term. Change-Id: Ibbe7fa2814434d4869aba20f628bd43269e611fa --- diff --git a/includes/Collation.php b/includes/Collation.php index 2734871f3d..a0e1d2d113 100644 --- a/includes/Collation.php +++ b/includes/Collation.php @@ -149,6 +149,8 @@ class IdentityCollation extends Collation { } class IcuCollation extends Collation { + const FIRST_LETTER_VERSION = 1; + var $primaryCollator, $mainCollator, $locale; var $firstLetterData; @@ -347,7 +349,9 @@ class IcuCollation extends Collation { $cacheKey = wfMemcKey( 'first-letters', $this->locale ); $cacheEntry = $cache->get( $cacheKey ); - if ( $cacheEntry ) { + if ( $cacheEntry && isset( $cacheEntry['version'] ) + && $cacheEntry['version'] == self::FIRST_LETTER_VERSION ) + { $this->firstLetterData = $cacheEntry; return $this->firstLetterData; } @@ -394,7 +398,8 @@ class IcuCollation extends Collation { ksort( $letterMap, SORT_STRING ); $data = array( 'chars' => array_values( $letterMap ), - 'keys' => array_keys( $letterMap ) + 'keys' => array_keys( $letterMap ), + 'version' => self::FIRST_LETTER_VERSION, ); // Reduce memory usage before caching