Aaron Schulz has uploaded a new change for review.

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

Change subject: Make MessageCache::load() require a language code
......................................................................

Make MessageCache::load() require a language code

Change-Id: I9f35d05a5e031d1c536a44b19b108803db068677
---
M includes/cache/MessageCache.php
M languages/LanguageConverter.php
2 files changed, 9 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/45/316045/1

diff --git a/includes/cache/MessageCache.php b/includes/cache/MessageCache.php
index f393acd..2ef5782 100644
--- a/includes/cache/MessageCache.php
+++ b/includes/cache/MessageCache.php
@@ -232,12 +232,9 @@
         * @throws MWException
         * @return bool
         */
-       function load( $code = false, $mode = null ) {
+       function load( $code, $mode = null ) {
                if ( !is_string( $code ) ) {
-                       # This isn't really nice, so at least make a note about 
it and try to
-                       # fall back
-                       wfDebug( __METHOD__ . " called without providing a 
language code\n" );
-                       $code = 'en';
+                       throw new InvalidArgumentException( "Missing language 
code" );
                }
 
                # Don't do double loading...
@@ -864,6 +861,8 @@
                                }
                                $alreadyTried[ $langcode ] = true;
                        }
+               } else {
+                       $uckey = null;
                }
 
                // Check the CDB cache
@@ -881,7 +880,8 @@
                                        continue;
                                }
 
-                               $message = $this->getMsgFromNamespace( 
$this->getMessagePageName( $code, $uckey ), $code );
+                               $message = $this->getMsgFromNamespace(
+                                       $this->getMessagePageName( $code, 
$uckey ), $code );
 
                                if ( $message !== false ) {
                                        return $message;
diff --git a/languages/LanguageConverter.php b/languages/LanguageConverter.php
index 1c003ad..5a9f652 100644
--- a/languages/LanguageConverter.php
+++ b/languages/LanguageConverter.php
@@ -48,7 +48,9 @@
        ];
 
        public $mMainLanguageCode;
-       public $mVariants, $mVariantFallbacks, $mVariantNames;
+       public $mVariants;
+       public $mVariantFallbacks;
+       public $mVariantNames;
        public $mTablesLoaded = false;
        public $mTables;
        // 'bidirectional' 'unidirectional' 'disable' for each variant

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9f35d05a5e031d1c536a44b19b108803db068677
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <asch...@wikimedia.org>

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

Reply via email to