40c8f602c0be4d7fb4074f3c0686767347ba633d
5 * @subpackage Maintenance
9 $options = array( 'update' => null, 'rebuild' => null );
10 require_once( "commandLine.inc" );
11 include_once( "InitialiseMessages.inc" );
13 $wgTitle = Title
::newFromText( "Rebuild messages script" );
15 if ( isset( $args[0] ) ) {
16 # Retain script compatibility
17 $response = array_shift( $args );
18 if ( $response == "update" ) {
20 } elseif ( $response == "rebuild" ) {
26 if ( isset( $args[0] ) ) {
27 $messages = loadLanguageFile( array_shift( $args ) );
31 if( isset( $options['update'] ) ) $response = 1;
32 if( isset( $options['rebuild'] ) ) $response = 2;
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";
40 Usage: php rebuildMessages.php <action> [filename]
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
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.
55 switch ( $response ) {
57 initialiseMessages( false, $messages );
60 initialiseMessages( true, $messages );