00001 <?php 00002 00003 # This is a drop-in replacement for commandLine.inc, for use only on 00004 # the Wikimedia wikis. 00005 # Call your command-line script with the language name and site name, 00006 # e.g. php convertLinks.php aa wikipedia 00007 00008 if ( isset( $_SERVER ) && array_key_exists( 'REQUEST_METHOD', $_SERVER ) ) { 00009 print "This script must be run from the command line\n"; 00010 exit(); 00011 } 00012 00013 $wgCommandLineMode = true; 00014 $self = array_shift( $argv ); 00015 # Turn off output buffering if it's on 00016 @ob_end_flush(); 00017 00018 if ( isset( $argv[0] ) ) { 00019 $lang = array_shift( $argv ); 00020 } else { 00021 $lang = "aa"; 00022 } 00023 if ( isset( $argv[0] ) ) { 00024 $site = array_shift( $argv ); 00025 } else { 00026 $site = "wikipedia"; 00027 } 00028 00029 # This is for the IRC scripts, which now run as the apache user 00030 if ( $_ENV['USER'] != "apache" ) { 00031 $wgDBadminuser = "wikiadmin"; 00032 $wgDBadminpassword = trim(`wikiadmin_pass`); 00033 } 00034 00035 $sep = strchr( $include_path = ini_get( "include_path" ), ";" ) ? ";" : ":"; 00036 putenv( "wikilang=$lang"); 00037 $newpath = "/home/wikipedia/common/php-new$sep"; 00038 00039 $DP = "../includes"; 00040 #ini_set( "include_path", "$newpath$sep$include_path" ); 00041 ini_set( "include_path", "/home/wikipedia/common/php-new:/home/wikipedia/common/php-new/includes" ); 00042 00043 require_once( "/home/wikipedia/common/php-new/CommonSettings.php" ); 00044 00045 $wgUsePHPTal = false; 00046 00047 define("MEDIAWIKI",true); 00048 require_once( "Setup.php" ); 00049 require_once( "../install-utils.inc" ); 00050 $wgTitle = Title::newFromText( "Command line script" ); 00051 $wgCommandLineMode = true; 00052 set_time_limit(0); 00053 ?>