From: Aaron Schulz Date: Sat, 15 Oct 2016 02:11:51 +0000 (-0700) Subject: Make MessageCache::load() require a language code X-Git-Tag: 1.31.0-rc.0~5074^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/supprimer.php?a=commitdiff_plain;h=aac4b448cf71149506f273cad52d4311f8819f86;p=lhc%2Fweb%2Fwiklou.git Make MessageCache::load() require a language code Also make it protected; no outside callers exist. Change-Id: I9f35d05a5e031d1c536a44b19b108803db068677 --- diff --git a/includes/cache/MessageCache.php b/includes/cache/MessageCache.php index f393acde06..b746fdec84 100644 --- a/includes/cache/MessageCache.php +++ b/includes/cache/MessageCache.php @@ -227,17 +227,14 @@ class MessageCache { * or false if populating empty cache fails. Also returns true if MessageCache * is disabled. * - * @param bool|string $code Language to which load messages - * @param integer $mode Use MessageCache::FOR_UPDATE to skip process cache + * @param string $code Language to which load messages + * @param integer $mode Use MessageCache::FOR_UPDATE to skip process cache [optional] * @throws MWException * @return bool */ - function load( $code = false, $mode = null ) { + protected 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 @@ class MessageCache { } $alreadyTried[ $langcode ] = true; } + } else { + $uckey = null; } // Check the CDB cache @@ -881,7 +880,8 @@ class MessageCache { 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 1c003adb4b..5a9f652ef0 100644 --- a/languages/LanguageConverter.php +++ b/languages/LanguageConverter.php @@ -48,7 +48,9 @@ class LanguageConverter { ]; public $mMainLanguageCode; - public $mVariants, $mVariantFallbacks, $mVariantNames; + public $mVariants; + public $mVariantFallbacks; + public $mVariantNames; public $mTablesLoaded = false; public $mTables; // 'bidirectional' 'unidirectional' 'disable' for each variant