primary key for recentchanges
[lhc/web/wiklou.git] / maintenance / rebuildMessages.php
1 <?php
2 require_once( "commandLine.inc" );
3 include_once( "InitialiseMessages.inc" );
4
5 $wgTitle = Title::newFromText( "Rebuild messages script" );
6
7 if ( isset( $args[0] ) ) {
8 $response = array_shift( $args );
9 if ( $response == "update" ) {
10 $response = 1;
11 } elseif ( $response == "rebuild" ) {
12 $response = 2;
13 }
14 } else {
15 $response = 0;
16 }
17 if ( isset( $args[0] ) ) {
18 $messages = loadLanguageFile( array_shift( $args ) );
19 } else {
20 $messages = false;
21 }
22
23 if ( $response == 0 ) {
24 $dbr =& wfGetDB( DB_SLAVE );
25 $row = $dbr->selectRow( "cur", array("count(*) as c"), array("cur_namespace" => NS_MEDIAWIKI) );
26 print "Current namespace size: {$row->c}\n";
27
28 print "1. Update messages to include latest additions to Language.php\n" .
29 "2. Delete all messages and reinitialise namespace\n" .
30 "3. Quit\n\n".
31
32 "Please enter a number: ";
33
34 do {
35 $response = IntVal(readconsole());
36 if ( $response >= 1 && $response <= 3 ) {
37 $good = true;
38 } else {
39 $good = false;
40 print "Please type a number between 1 and 3: ";
41 }
42 } while ( !$good );
43 }
44
45 switch ( $response ) {
46 case 1:
47 initialiseMessages( false, $messages );
48 break;
49 case 2:
50 initialiseMessages( true, $messages );
51 break;
52 }
53
54 exit();
55
56 ?>