Merge "(bug 38093) Gender of changed user groups missing in log"
[lhc/web/wiklou.git] / includes / cache / MessageCache.php
index 1d0ab90..24f32d6 100644 (file)
@@ -1,5 +1,22 @@
 <?php
 /**
+ * Localisation messages cache.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
  * @file
  * @ingroup Cache
  */
@@ -115,6 +132,7 @@ class MessageCache {
        function getParserOptions() {
                if ( !$this->mParserOptions ) {
                        $this->mParserOptions = new ParserOptions;
+                       $this->mParserOptions->setEditSection( false );
                }
                return $this->mParserOptions;
        }
@@ -497,7 +515,7 @@ class MessageCache {
                if ( $code === 'en'  ) {
                        // Delete all sidebars, like for example on action=purge on the
                        // sidebar messages
-                       $codes = array_keys( Language::getLanguageNames() );
+                       $codes = array_keys( Language::fetchLanguageNames() );
                }
 
                global $wgMemc;
@@ -753,7 +771,7 @@ class MessageCache {
                        $message = $revision->getText();
                        if ($message === false) {
                                // A possibly temporary loading failure.
-                               wfDebugLog( 'MessageCache', __METHOD__ . ": failed to load message page text for {$title->getDbKey()} ($code)" );
+                               wfDebugLog( 'MessageCache', __METHOD__ . ": failed to load message page text for {$title} ($code)" );
                        } else {
                                $this->mCache[$code][$title] = ' ' . $message;
                                $this->mMemc->set( $titleKey, ' ' . $message, $this->mExpiry );
@@ -834,13 +852,8 @@ class MessageCache {
 
                $parser = $this->getParser();
                $popts = $this->getParserOptions();
-
-               if ( $interface ) {
-                       $popts->setInterfaceMessage( true );
-               }
-               if ( $language !== null ) {
-                       $popts->setTargetLanguage( $language );
-               }
+               $popts->setInterfaceMessage( $interface );
+               $popts->setTargetLanguage( $language );
 
                wfProfileIn( __METHOD__ );
                if ( !$title || !$title instanceof Title ) {
@@ -874,7 +887,7 @@ class MessageCache {
         * Clear all stored messages. Mainly used after a mass rebuild.
         */
        function clear() {
-               $langs = Language::getLanguageNames( false );
+               $langs = Language::fetchLanguageNames( null, 'mw' );
                foreach ( array_keys($langs) as $code ) {
                        # Global cache
                        $this->mMemc->delete( wfMemcKey( 'messages', $code ) );
@@ -896,8 +909,7 @@ class MessageCache {
                }
 
                $lang = array_pop( $pieces );
-               $validCodes = Language::getLanguageNames();
-               if( !array_key_exists( $lang, $validCodes ) ) {
+               if( !Language::fetchLanguageName( $lang, null, 'mw' ) ) {
                        return array( $key, $wgLanguageCode );
                }