Fix for compatibility with short_open_tag = Off
[lhc/web/wiklou.git] / maintenance / rebuildMessages.php
1 <?php
2 $wgCommandLineMode = true;
3
4 $sep = strchr( $include_path = ini_get( "include_path" ), ";" ) ? ";" : ":";
5 if ( $argv[1] ) {
6 $lang = $argv[1];
7 putenv( "wikilang=$lang");
8 $settingsFile = "/apache/htdocs/{$argv[1]}/w/LocalSettings.php";
9 $newpath = "/apache/common/php$sep";
10 } else {
11 $settingsFile = "../LocalSettings.php";
12 $newpath = "";
13 }
14
15 if ( $argv[2] ) {
16 $patterns = explode( ",", $argv[2]);
17 } else {
18 $patterns = false;
19 }
20
21 if ( ! is_readable( $settingsFile ) ) {
22 print "A copy of your installation's LocalSettings.php\n" .
23 "must exist in the source directory.\n";
24 exit();
25 }
26
27 ini_set( "include_path", "../includes$sep../languages$sep$newpath$IP$sep$include_path" );
28
29 $wgCommandLineMode = true;
30 $DP = "../includes";
31 include_once( $settingsFile );
32
33 include_once( "Setup.php" );
34 include_once( "./InitialiseMessages.inc" );
35 include_once( "../install-utils.inc" );
36 $wgTitle = Title::newFromText( "Rebuild messages script" );
37 $wgCommandLineMode = true;
38 set_time_limit(0);
39
40 $row = wfGetArray( "cur", array("count(*) as c"), array("cur_namespace" => NS_MEDIAWIKI) );
41 print "Current namespace size: {$row->c}\n";
42
43 print "1. Update messages to include latest additions to Language.php\n" .
44 "2. Delete all messages and reinitialise namespace\n" .
45 "3. Quit\n\n".
46
47 "Please enter a number: ";
48
49 do {
50 $response = IntVal(readconsole());
51 if ( $response >= 1 && $response <= 3 ) {
52 $good = true;
53 } else {
54 $good = false;
55 print "Please type a number between 1 and 3: ";
56 }
57 } while ( !$good );
58
59 switch ( $response ) {
60 case 1:
61 initialiseMessages( false );
62 break;
63 case 2:
64 initialiseMessages( true );
65 break;
66 }
67
68 exit();
69
70 ?>