no need for position:absolute
[lhc/web/wiklou.git] / maintenance / rebuildMessages.php
1 <?php
2 /**
3 * @todo document
4 * @package MediaWiki
5 * @subpackage Maintenance
6 */
7
8 /** */
9 $options = array( 'update' => null, 'rebuild' => null );
10 require_once( "commandLine.inc" );
11 include_once( "InitialiseMessages.inc" );
12
13 $wgTitle = Title::newFromText( "Rebuild messages script" );
14
15 if ( isset( $args[0] ) ) {
16 # Retain script compatibility
17 $response = array_shift( $args );
18 if ( $response == "update" ) {
19 $response = 1;
20 } elseif ( $response == "rebuild" ) {
21 $response = 2;
22 }
23 } else {
24 $response = 0;
25 }
26 if ( isset( $args[0] ) ) {
27 $messages = loadLanguageFile( array_shift( $args ) );
28 } else {
29 $messages = false;
30 }
31 if( isset( $options['update'] ) ) $response = 1;
32 if( isset( $options['rebuild'] ) ) $response = 2;
33
34 if ( $response == 0 ) {
35 $dbr =& wfGetDB( DB_SLAVE );
36 $row = $dbr->selectRow( "page", array("count(*) as c"), array("page_namespace" => NS_MEDIAWIKI) );
37 print "Current namespace size: {$row->c}\n";
38
39 print <<<END
40 Usage: php rebuildMessages.php <action> [filename]
41
42 Action must be one of:
43 --update Update messages to include latest additions to Language.php
44 --rebuild Delete all messages and reinitialise namespace
45
46 If a message dump file is given, messages will be read from it to supplement
47 the defaults in MediaWiki's Language*.php. The file should contain a serialized
48 PHP associative array, as produced by dumpMessages.php.
49
50
51 END;
52 exit(0);
53 }
54
55 switch ( $response ) {
56 case 1:
57 initialiseMessages( false, $messages );
58 break;
59 case 2:
60 initialiseMessages( true, $messages );
61 break;
62 }
63
64 exit();
65
66 ?>