IAlex has uploaded a new change for review.

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

Change subject: Fix language statistics after messages have been moved to JSON
......................................................................

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
---
M includes/cache/LocalisationCache.php
M maintenance/language/languages.inc
2 files changed, 8 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/58/123358/1

diff --git a/includes/cache/LocalisationCache.php 
b/includes/cache/LocalisationCache.php
index 8827219..b89316b 100644
--- a/includes/cache/LocalisationCache.php
+++ b/includes/cache/LocalisationCache.php
@@ -539,7 +539,7 @@
         * @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 61ee424..0483aea 100644
--- a/maintenance/language/languages.inc
+++ b/maintenance/language/languages.inc
@@ -125,12 +125,16 @@
                $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;
                        }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib52287db618b9d072e847130070d165a3e7ae44b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: IAlex <coderev...@emsenhuber.ch>

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

Reply via email to