Made MessageCache::replace() ignore messages with content language suffix
authorAaron Schulz <aschulz@wikimedia.org>
Wed, 20 May 2015 22:39:52 +0000 (15:39 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Tue, 9 Jun 2015 09:39:55 +0000 (02:39 -0700)
* This should not be used, and load() does not see them.
  If the content language is 'de', then message overrides
  will not include MediaWiki:<key>/de pages.

Change-Id: Ie4b6b356bd309814dd4a88040a29a7ebd509712a

includes/cache/MessageCache.php

index 86b073c..99b969f 100644 (file)
@@ -517,13 +517,17 @@ class MessageCache {
         * @param mixed $text New contents of the page.
         */
        public function replace( $title, $text ) {
-               global $wgMaxMsgCacheEntrySize, $wgContLang;
+               global $wgMaxMsgCacheEntrySize, $wgContLang, $wgLanguageCode;
 
                if ( $this->mDisable ) {
                        return;
                }
 
                list( $msg, $code ) = $this->figureMessage( $title );
+               if ( strpos( $title, '/' ) !== false && $code === $wgLanguageCode ) {
+                       # Content language overrides do not use the /<code> suffix
+                       return;
+               }
 
                $cacheKey = wfMemcKey( 'messages', $code );
                $this->lock( $cacheKey );
@@ -567,7 +571,6 @@ class MessageCache {
                $blobStore->updateMessage( $wgContLang->lcfirst( $msg ) );
 
                Hooks::run( 'MessageCacheReplace', array( $title, $text ) );
-
        }
 
        /**
@@ -1088,6 +1091,7 @@ class MessageCache {
         */
        public function figureMessage( $key ) {
                global $wgLanguageCode;
+
                $pieces = explode( '/', $key );
                if ( count( $pieces ) < 2 ) {
                        return array( $key, $wgLanguageCode );