Index: trunk/extensions/Translate/scripts/createMessageIndex.php |
— | — | @@ -14,4 +14,27 @@ |
15 | 15 | |
16 | 16 | require( dirname( __FILE__ ) . '/cli.inc' ); |
17 | 17 | |
18 | | -MessageIndexRebuilder::execute(); |
\ No newline at end of file |
| 18 | +function showUsage() { |
| 19 | + STDERR( <<<EOT |
| 20 | +Message index creation command line script |
| 21 | + |
| 22 | +Usage: php createMessageIndex.php [options...] |
| 23 | + |
| 24 | +Options: |
| 25 | + --help Show this help text |
| 26 | + --progress Report on progress (default: false) |
| 27 | + |
| 28 | +EOT |
| 29 | +); |
| 30 | + exit( 1 ); |
| 31 | +} |
| 32 | + |
| 33 | +if ( isset( $options['help'] ) ) { |
| 34 | + showUsage(); |
| 35 | +} |
| 36 | + |
| 37 | +if ( isset( $options['progress'] ) ) { |
| 38 | + MessageIndexRebuilder::execute(); |
| 39 | +} else { |
| 40 | + MessageIndexRebuilder::execute( false ); |
| 41 | +} |
Index: trunk/extensions/Translate/utils/MessageIndexRebuilder.php |
— | — | @@ -13,14 +13,18 @@ |
14 | 14 | */ |
15 | 15 | |
16 | 16 | class MessageIndexRebuilder { |
17 | | - public static function execute() { |
| 17 | + protected $reportProgress; |
18 | 18 | |
| 19 | + public static function execute( $reportProgress = true ) { |
19 | 20 | $groups = MessageGroups::singleton()->getGroups(); |
20 | 21 | |
21 | 22 | $hugearray = array(); |
22 | 23 | $postponed = array(); |
23 | 24 | |
24 | | - STDOUT( "Working with ", 'main' ); |
| 25 | + if( $reportProgress ) { |
| 26 | + STDOUT( "Working with ", 'main' ); |
| 27 | + $this->reportProgress = true; |
| 28 | + } |
25 | 29 | |
26 | 30 | foreach ( $groups as $g ) { |
27 | 31 | if ( !$g->exists() ) continue; |
— | — | @@ -36,7 +40,7 @@ |
37 | 41 | foreach ( $postponed as $g ) { |
38 | 42 | self::checkAndAdd( $hugearray, $g, true ); |
39 | 43 | } |
40 | | - |
| 44 | + |
41 | 45 | global $wgCacheDirectory; |
42 | 46 | $filename = "$wgCacheDirectory/translate_messageindex.cdb"; |
43 | 47 | $writer = CdbWriter::open( $filename ); |
— | — | @@ -60,7 +64,9 @@ |
61 | 65 | |
62 | 66 | $id = $g->getId(); |
63 | 67 | |
64 | | - STDOUT( "$id ", 'main' ); |
| 68 | + if( $this->reportProgress ) { |
| 69 | + STDOUT( "$id ", 'main' ); |
| 70 | + } |
65 | 71 | |
66 | 72 | $namespace = $g->getNamespace(); |
67 | 73 | |
— | — | @@ -92,4 +98,4 @@ |
93 | 99 | } |
94 | 100 | unset( $id ); // Disconnect the previous references to this $id |
95 | 101 | } |
96 | | -} |
\ No newline at end of file |
| 102 | +} |