From: Alexandre Emsenhuber Date: Wed, 2 Apr 2014 18:05:51 +0000 (+0200) Subject: Fix language statistics after messages have been moved to JSON X-Git-Tag: 1.31.0-rc.0~16394^2 X-Git-Url: http://git.cyclocoop.org/%27%20.%20url_absolue%28%24favicon%29%20.%20?a=commitdiff_plain;h=6ea0417cef4963ab92c2f50604eea87a9e912363;p=lhc%2Fweb%2Fwiklou.git Fix language statistics after messages have been moved to JSON Statistics are now showing always no messages since languages.inc does not manage to load the JSON messages. Had to make LocalisationCache::readJSONFile() public so that it can be used in languages.inc; since all methods from LocalisationCache return localisations merged with fallbacks, which is not what we want here. Fix for I918cfdc46c (0dd91d5). Change-Id: Ib52287db618b9d072e847130070d165a3e7ae44b --- diff --git a/includes/cache/LocalisationCache.php b/includes/cache/LocalisationCache.php index 8827219e01..b89316bc32 100644 --- a/includes/cache/LocalisationCache.php +++ b/includes/cache/LocalisationCache.php @@ -539,7 +539,7 @@ class LocalisationCache { * @throws MWException if there is a syntax error in the JSON file * @return array with a 'messages' key, or empty array if the file doesn't exist */ - protected function readJSONFile( $fileName ) { + public function readJSONFile( $fileName ) { wfProfileIn( __METHOD__ ); if ( !is_readable( $fileName ) ) { diff --git a/maintenance/language/languages.inc b/maintenance/language/languages.inc index 61ee424a99..0483aea714 100644 --- a/maintenance/language/languages.inc +++ b/maintenance/language/languages.inc @@ -125,12 +125,16 @@ class Languages { $this->mNamespaceAliases[$code] = array(); $this->mMagicWords[$code] = array(); $this->mSpecialPageAliases[$code] = array(); + + $jsonfilename = Language::getJsonMessagesFileName( $code ); + if ( file_exists( $jsonfilename ) ) { + $json = Language::getLocalisationCache()->readJSONFile( $jsonfilename ); + $this->mRawMessages[$code] = $json['messages']; + } + $filename = Language::getMessagesFileName( $code ); if ( file_exists( $filename ) ) { require $filename; - if ( isset( $messages ) ) { - $this->mRawMessages[$code] = $messages; - } if ( isset( $fallback ) ) { $this->mFallback[$code] = $fallback; }