r101156 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101155‎ | r101156 | r101157 >
Date:17:30, 28 October 2011
Author:reedy
Status:ok
Tags:
Comment:
Comment out some unused variables

Documentation

Trim trailing whitespace
Modified paths:
  • /trunk/extensions/LocalisationUpdate/LocalisationUpdate.class.php (modified) (history)
  • /trunk/extensions/LocalisationUpdate/tests/tokenTest.php (modified) (history)

Diff [purge]

Index: trunk/extensions/LocalisationUpdate/tests/tokenTest.php
@@ -32,7 +32,7 @@
3333 if( count( $args ) ) {
3434 $sources = $args;
3535 } else {
36 - $sources =
 36+ $sources =
3737 array_merge(
3838 glob("$IP/extensions/*/*.i18n.php"),
3939 glob("$IP/languages/messages/Messages*.php") );
@@ -41,9 +41,9 @@
4242 foreach( $sources as $sourceFile ) {
4343 $rel = basename( $sourceFile );
4444 $out = str_replace( '/', '-', $rel );
45 -
 45+
4646 $sourceData = file_get_contents( $sourceFile );
47 -
 47+
4848 if( preg_match( '!extensions/!', $sourceFile ) ) {
4949 $sourceData = LocalisationUpdate::cleanupExtensionFile( $sourceData );
5050 $items = 'langs';
@@ -51,32 +51,32 @@
5252 $sourceData = LocalisationUpdate::cleanupFile( $sourceData );
5353 $items = 'messages';
5454 }
55 -
 55+
5656 file_put_contents( "$out.txt", $sourceData );
5757
5858 $start = microtime(true);
5959 $eval = evalExtractArray( $sourceData, 'messages' );
6060 $deltaEval = microtime(true) - $start;
61 -
 61+
6262 $start = microtime(true);
6363 $quick = quickTokenExtractArray( $sourceData, 'messages' );
6464 $deltaQuick = microtime(true) - $start;
65 -
 65+
6666 $start = microtime(true);
6767 $token = confExtractArray( $sourceData, 'messages' );
6868 $deltaToken = microtime(true) - $start;
69 -
 69+
7070 $hashEval = md5(serialize($eval));
7171 $hashToken = md5(serialize($token));
7272 $hashQuick = md5(serialize($quick));
7373 $countEval = count( (array)$eval);
7474 $countToken = count( (array)$token );
7575 $countQuick = count( (array)$quick );
76 -
 76+
7777 printf( "%s %s %d $items - %0.1fms - eval\n", $rel, $hashEval, $countEval, $deltaEval * 1000 );
7878 printf( "%s %s %d $items - %0.1fms - QuickArrayReader\n", $rel, $hashQuick, $countQuick, $deltaQuick * 1000 );
7979 printf( "%s %s %d $items - %0.1fms - ConfEditor\n", $rel, $hashToken, $countToken, $deltaToken * 1000 );
80 -
 80+
8181 if( $hashEval !== $hashToken || $hashEval !== $hashQuick ) {
8282 echo "FAILED on $rel\n";
8383 file_put_contents( "$out-eval.txt", var_export( $eval, true ) );
Index: trunk/extensions/LocalisationUpdate/LocalisationUpdate.class.php
@@ -111,7 +111,7 @@
112112
113113 // Create a full path.
114114 // TODO: add support for $wgExtensionAssetsPath
115 - $localfile = "$IP/extensions/$relfile";
 115+ // $localfile = "$IP/extensions/$relfile";
116116
117117 // Get the full SVN directory path.
118118 // TODO: add support for $wgExtensionAssetsPath
@@ -401,6 +401,10 @@
402402 return @$hashes[$file] !== $hash;
403403 }
404404
 405+ /**
 406+ * @param $file
 407+ * @param $hash
 408+ */
405409 public static function saveHash( $file, $hash ) {
406410 if ( is_null( self::$newHashes ) ) {
407411 self::$newHashes = self::readFile( 'hashes' );
@@ -594,6 +598,7 @@
595599 * Logs a message.
596600 *
597601 * @param $log String
 602+ * @param bool $verbose
598603 */
599604 public static function myLog( $log, $verbose = true ) {
600605 if ( !$verbose ) {
@@ -621,6 +626,11 @@
622627 }
623628 }
624629
 630+ /**
 631+ * @param $lang
 632+ * @return string
 633+ * @throws MWException
 634+ */
625635 public static function filename( $lang ) {
626636 global $wgLocalisationUpdateDirectory, $wgCacheDirectory;
627637
@@ -635,6 +645,10 @@
636646 return "$dir/l10nupdate-$lang.cache";
637647 }
638648
 649+ /**
 650+ * @param $lang
 651+ * @return mixed
 652+ */
639653 public static function readFile( $lang ) {
640654 if ( !isset( self::$filecache[$lang] ) ) {
641655 $file = self::filename( $lang );
@@ -657,6 +671,11 @@
658672 return self::$filecache[$lang];
659673 }
660674
 675+ /**
 676+ * @param $lang
 677+ * @param $var
 678+ * @throws MWException
 679+ */
661680 public static function writeFile( $lang, $var ) {
662681 $file = self::filename( $lang );
663682

Status & tagging log