diff options
author | Tim Starling <tstarling@wikimedia.org> | 2013-03-13 14:53:20 +1100 |
---|---|---|
committer | Tim Starling <tstarling@wikimedia.org> | 2013-03-13 14:58:40 +1100 |
commit | 3fb87cf28f9d7222ea58ad8d4b644bcb02bae8a0 (patch) | |
tree | fd8b13bedbda5ca8aba140cc66dd9de7784e4755 | |
parent | 7cd380ab8feabe6aff2db688971fa0d1e94a2b05 (diff) |
Allow first letter data to be invalidatedorigin/wmf/1.21wmf10
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
-rw-r--r-- | includes/Collation.php | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/includes/Collation.php b/includes/Collation.php index a7dd5bd0875b..412e5d16644c 100644 --- a/includes/Collation.php +++ b/includes/Collation.php @@ -168,6 +168,8 @@ class IdentityCollation extends Collation { class IcuCollation extends Collation { + const FIRST_LETTER_VERSION = 1; + var $primaryCollator, $mainCollator, $locale; var $firstLetterData; @@ -359,7 +361,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; } @@ -406,7 +410,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 |