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
This commit is contained in:
Alexandre Emsenhuber 2014-04-02 20:05:51 +02:00
parent 16787035f4
commit 6ea0417cef
2 changed files with 8 additions and 4 deletions

View file

@ -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 ) ) {

View file

@ -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;
}