Index: trunk/phase3/maintenance/rebuildMessages.php |
— | — | @@ -6,12 +6,14 @@ |
7 | 7 | */ |
8 | 8 | |
9 | 9 | /** */ |
| 10 | +$options = array( 'update' => null, 'rebuild' => null ); |
10 | 11 | require_once( "commandLine.inc" ); |
11 | 12 | include_once( "InitialiseMessages.inc" ); |
12 | 13 | |
13 | 14 | $wgTitle = Title::newFromText( "Rebuild messages script" ); |
14 | 15 | |
15 | 16 | if ( isset( $args[0] ) ) { |
| 17 | + # Retain script compatibility |
16 | 18 | $response = array_shift( $args ); |
17 | 19 | if ( $response == "update" ) { |
18 | 20 | $response = 1; |
— | — | @@ -26,27 +28,28 @@ |
27 | 29 | } else { |
28 | 30 | $messages = false; |
29 | 31 | } |
| 32 | +if( isset( $options['update'] ) ) $response = 1; |
| 33 | +if( isset( $options['rebuild'] ) ) $response = 2; |
30 | 34 | |
31 | 35 | if ( $response == 0 ) { |
32 | 36 | $dbr =& wfGetDB( DB_SLAVE ); |
33 | 37 | $row = $dbr->selectRow( "cur", array("count(*) as c"), array("cur_namespace" => NS_MEDIAWIKI) ); |
34 | 38 | print "Current namespace size: {$row->c}\n"; |
35 | 39 | |
36 | | - print "1. Update messages to include latest additions to Language.php\n" . |
37 | | - "2. Delete all messages and reinitialise namespace\n" . |
38 | | - "3. Quit\n\n". |
39 | | - |
40 | | - "Please enter a number: "; |
| 40 | + print <<<END |
| 41 | +Usage: php rebuildMessages.php <action> [filename] |
41 | 42 | |
42 | | - do { |
43 | | - $response = IntVal(readconsole()); |
44 | | - if ( $response >= 1 && $response <= 3 ) { |
45 | | - $good = true; |
46 | | - } else { |
47 | | - $good = false; |
48 | | - print "Please type a number between 1 and 3: "; |
49 | | - } |
50 | | - } while ( !$good ); |
| 43 | +Action must be one of: |
| 44 | + --update Update messages to include latest additions to Language.php |
| 45 | + --rebuild Delete all messages and reinitialise namespace |
| 46 | + |
| 47 | +If a message dump file is given, messages will be read from it to supplement |
| 48 | +the defaults in MediaWiki's Language*.php. The file should contain a serialized |
| 49 | +PHP associative array, as produced by dumpMessages.php. |
| 50 | + |
| 51 | + |
| 52 | +END; |
| 53 | + exit(0); |
51 | 54 | } |
52 | 55 | |
53 | 56 | switch ( $response ) { |