Tim Starling has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/53511


Change subject: Allow first letter data to be invalidated
......................................................................

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
---
M includes/Collation.php
1 file changed, 7 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/11/53511/1

diff --git a/includes/Collation.php b/includes/Collation.php
index a7dd5bd..412e5d1 100644
--- a/includes/Collation.php
+++ b/includes/Collation.php
@@ -168,6 +168,8 @@
 
 
 class IcuCollation extends Collation {
+       const FIRST_LETTER_VERSION = 1;
+
        var $primaryCollator, $mainCollator, $locale;
        var $firstLetterData;
 
@@ -359,7 +361,9 @@
                $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 @@
                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

-- 
To view, visit https://gerrit.wikimedia.org/r/53511
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibbe7fa2814434d4869aba20f628bd43269e611fa
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: wmf/1.21wmf10
Gerrit-Owner: Tim Starling <tstarl...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to