67d09d19c275cf4b06dcdb338c989f518c1077c2
[lhc/web/wiklou.git] / maintenance / liveCmdLine.inc
1 <?php
2
3 # This is a drop-in replacement for commandLine.inc, for use only on
4 # the Wikimedia wikis.
5 # Call your command-line script with the language name and site name,
6 # e.g. php convertLinks.php aa wikipedia
7
8 if ( isset( $_SERVER ) && array_key_exists( 'REQUEST_METHOD', $_SERVER ) ) {
9 print "This script must be run from the command line\n";
10 exit();
11 }
12
13 $wgCommandLineMode = true;
14 $self = array_shift( $argv );
15 # Turn off output buffering if it's on
16 @ob_end_flush();
17
18 if ( isset( $argv[0] ) ) {
19 $lang = array_shift( $argv );
20 } else {
21 $lang = "aa";
22 }
23 if ( isset( $argv[0] ) ) {
24 $site = array_shift( $argv );
25 } else {
26 $site = "wikipedia";
27 }
28
29 # This is for the IRC scripts, which now run as the apache user
30 if ( $_ENV['USER'] != "apache" ) {
31 $wgDBadminuser = "wikiadmin";
32 $wgDBadminpassword = trim(`wikiadmin_pass`);
33 }
34
35 $sep = strchr( $include_path = ini_get( "include_path" ), ";" ) ? ";" : ":";
36 putenv( "wikilang=$lang");
37 $newpath = "/home/wikipedia/common/php-new$sep";
38
39 $DP = "../includes";
40 #ini_set( "include_path", "$newpath$sep$include_path" );
41 ini_set( "include_path", "/home/wikipedia/common/php-new:/home/wikipedia/common/php-new/includes" );
42
43 require_once( "/home/wikipedia/common/php-new/CommonSettings.php" );
44
45 $wgUsePHPTal = false;
46
47 define("MEDIAWIKI",true);
48 require_once( "Setup.php" );
49 require_once( "../install-utils.inc" );
50 $wgTitle = Title::newFromText( "Command line script" );
51 $wgCommandLineMode = true;
52 set_time_limit(0);
53 ?>