r54986 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r54985‎ | r54986 | r54987 >
Date:00:06, 14 August 2009
Author:brion
Status:deferred (Comments)
Tags:
Comment:
No sense re-parsing unchanged files just because we're loading them off local disk...
Modified paths:
  • /trunk/extensions/LocalisationUpdate/LocalisationUpdate.class.php (modified) (history)

Diff [purge]

Index: trunk/extensions/LocalisationUpdate/LocalisationUpdate.class.php
@@ -88,7 +88,7 @@
8989 closedir( $dir );
9090
9191 // Find the changed English strings (as these messages won't be updated in ANY language)
92 - $changedEnglishStrings = self::compareFiles( $localdir . "/MessagesEn.php", $svndir . "/MessagesEn.php", $verbose );
 92+ $changedEnglishStrings = self::compareFiles( $localdir . "/MessagesEn.php", $svndir . "/MessagesEn.php", $verbose, true );
9393
9494 // Count the changes
9595 $changedCount = 0;
@@ -184,8 +184,8 @@
185185 $basefilecontents = preg_replace( "/\\\$messages/", "\$base_messages", $basefilecontents );
186186
187187 $basehash = md5( $basefilecontents );
188 - // If this is the remote file check if the file has changed since our last update
189 - if ( preg_match( "/^http/", $basefile ) && !$alwaysGetResult ) {
 188+ // Check if the file has changed since our last update
 189+ if ( !$alwaysGetResult ) {
190190 if ( !self::checkHash( $basefile, $basehash ) ) {
191191 self::myLog( "Skipping {$langcode} since the remote file hasn't changed since our last update" );
192192 return array();
@@ -243,13 +243,9 @@
244244 }
245245
246246
247 - if ( preg_match( "/^http/", $basefile )) {
248 - self::saveHash( $basefile, $basehash );
249 - }
 247+ self::saveHash( $basefile, $basehash );
250248
251 - if ( preg_match( "/^http/", $comparefile )) {
252 - self::saveHash( $comparefile, $comparehash );
253 - }
 249+ self::saveHash( $comparefile, $comparehash );
254250
255251 return $changedStrings;
256252 }
@@ -455,13 +451,9 @@
456452 // And log some stuff
457453 self::myLog( "Updated " . $updates . " messages for the '{$extension}' extension" );
458454
459 - if ( preg_match( "/^http/", $basefile )) {
460 - self::saveHash( $basefile, $basehash );
461 - }
 455+ self::saveHash( $basefile, $basehash );
462456
463 - if ( preg_match( "/^http/", $comparefile )) {
464 - self::saveHash( $comparefile, $comparehash );
465 - }
 457+ self::saveHash( $comparefile, $comparehash );
466458
467459 return $updates;
468460 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r82447Partial revert of r54986: passing true for an array parameter that's type-hin...catrope12:05, 19 February 2011

Comments

#Comment by Catrope (talk | contribs)   12:06, 19 February 2011
-		$changedEnglishStrings = self::compareFiles( $localdir . "/MessagesEn.php", $svndir . "/MessagesEn.php", $verbose );
+		$changedEnglishStrings = self::compareFiles( $localdir . "/MessagesEn.php", $svndir . "/MessagesEn.php", $verbose, true );

This broke the update script because the fourth parameter to compareFiles() is type-hinted as being an array. I've reverted this line in r82447, but since you probably intended to achieve something with this addition, it'd be nice to know what that was so it can be done right.

Status & tagging log