r106199 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106198‎ | r106199 | r106200 >
Date:14:27, 14 December 2011
Author:catrope
Status:ok
Tags:
Comment:
Followup r106194: some files deliberately don't have a $messages array because they're fallback-only, let those through
Modified paths:
  • /trunk/extensions/LocalisationUpdate/LocalisationUpdate.class.php (modified) (history)

Diff [purge]

Index: trunk/extensions/LocalisationUpdate/LocalisationUpdate.class.php
@@ -348,9 +348,14 @@
349349 // Get the array with messages.
350350 $base_messages = self::parsePHP( $basefilecontents, 'base_messages' );
351351 if ( !is_array( $base_messages ) ) {
352 - // Broken file? Report and bail
353 - self::myLog( "Failed to parse $basefile" );
354 - return array();
 352+ if ( strpos( $basefilecontents, "\$base_messages" ) === false ) {
 353+ // No $messages array. This happens for some languages that only have a fallback
 354+ $base_messages = array();
 355+ } else {
 356+ // Broken file? Report and bail
 357+ self::myLog( "Failed to parse $basefile" );
 358+ return array();
 359+ }
355360 }
356361
357362 $comparefilecontents = self::getFileContents( $comparefile );
@@ -379,8 +384,14 @@
380385 $compare_messages = self::parsePHP( $comparefilecontents, 'compare_messages' );
381386 if ( !is_array( $compare_messages ) ) {
382387 // Broken file? Report and bail
383 - self::myLog( "Failed to parse $comparefile" );
384 - return array();
 388+ if ( strpos( $comparefilecontents, "\$compare_messages" ) === false ) {
 389+ // No $messages array. This happens for some languages that only have a fallback
 390+ self::myLog( "Skipping $langcode , no messages array in $comparefile", $verbose );
 391+ $compare_messages = array();
 392+ } else {
 393+ self::myLog( "Failed to parse $comparefile" );
 394+ return array();
 395+ }
385396 }
386397
387398 // If the localfile and the remote file are the same, skip them!

Follow-up revisions

RevisionCommit summaryAuthorDate
r1062001.18wmf1: MFT r106199catrope14:28, 14 December 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r106194Log failures to read or parse message filescatrope14:01, 14 December 2011

Status & tagging log