Command line header for the Wikimedia wikis. Doesn't contain any sensitive informatio...
[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
15 if ( isset( $argv[1] ) ) {
16 $lang = $argv[1];
17 } else {
18 $lang = "aa";
19 }
20 if ( isset( $argv[2] ) ) {
21 $site = $argv[2];
22 } else {
23 $site = "wikipedia";
24 }
25
26 # This is for the IRC scripts, which now run as the apache user
27 if ( $_ENV['USER'] != "apache" ) {
28 $wgDBadminuser = "wikiadmin";
29 $wgDBadminpassword = trim(`wikiadmin_pass`);
30 }
31
32 $sep = strchr( $include_path = ini_get( "include_path" ), ";" ) ? ";" : ":";
33 putenv( "wikilang=$lang");
34 $newpath = "/home/wikipedia/common/php-new$sep";
35
36 $DP = "../includes";
37 #ini_set( "include_path", "$newpath$sep$include_path" );
38 ini_set( "include_path", "/home/wikipedia/common/php-new:/home/wikipedia/common/php-new/includes" );
39
40 require_once( "/home/wikipedia/common/php-new/CommonSettings.php" );
41
42 $wgUsePHPTal = false;
43
44 define("MEDIAWIKI",true);
45 include_once( "Setup.php" );
46 $wgTitle = Title::newFromText( "Command line script" );
47 $wgCommandLineMode = true;
48 set_time_limit(0);
49 ?>