X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=maintenance%2FcommandLine.inc;h=fd13bdcb146b05cb8828ecd7f0c2805db7273f96;hb=ad787f1574b7598868e12d1a4a9bba3ca23d4a8f;hp=86f073184094ea13b2ade1bbecab5967e98c8fca;hpb=cdb3f96ab8f00a5e27a7333731e862d6896c989d;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/commandLine.inc b/maintenance/commandLine.inc index 86f0731840..fd13bdcb14 100644 --- a/maintenance/commandLine.inc +++ b/maintenance/commandLine.inc @@ -1,147 +1,47 @@ 1 ) { - $option = $bits[0]; - $param = $bits[1]; - } else { - $param = 1; - } - $options[$option] = $param; - } - } elseif ( $arg{0} == '-' ) { - # Short options - for ( $p=1; $paddOption( $name, '', false, true ); } - } else { - $args[] = $arg; } -} - -# General initialisation -$wgCommandLineMode = true; -# Turn off output buffering if it's on -@ob_end_flush(); -$sep = strchr( $include_path = ini_get( "include_path" ), ";" ) ? ";" : ":"; + public function getDbType() { + global $wgUseNormalUser; -if ( $sep == ":" && strpos( `hostname`, "wikimedia.org" ) !== false ) { - $wgWikiFarm = true; - require_once( "$IP/includes/SiteConfiguration.php" ); - - # Get $conf - require( "$IP/InitialiseSettings.php" ); - - # Check if we were passed a db name - $db = array_shift( $args ); - list( $site, $lang ) = $conf->siteFromDB( $db ); - - # If not, work out the language and site the old way - if ( is_null( $site ) || is_null( $lang ) ) { - if ( !$db ) { - $lang = "aa"; - } else { - $lang = $db; - } - if ( isset( $args[0] ) ) { - $site = array_shift( $args ); - } else { - $site = "wikipedia"; - } + return ( isset( $wgUseNormalUser ) && $wgUseNormalUser ) ? + Maintenance::DB_STD : Maintenance::DB_ADMIN; } - # This is for the IRC scripts, which now run as the apache user - # The apache user doesn't have access to the wikiadmin_pass command - if ( $_ENV['USER'] != "apache" ) { - $wgDBuser = $wgDBadminuser = "wikiadmin"; - $wgDBpassword = $wgDBadminpassword = trim(`wikiadmin_pass`); + /** + * No help, it would just be misleading since it misses custom options + */ + protected function maybeHelp( $force = false ) { + if ( !$force ) + return; + parent::maybeHelp( true ); } - putenv( "wikilang=$lang"); - - $DP = $IP; - ini_set( "include_path", ".:$IP:$IP/includes:$IP/languages:$IP/maintenance" ); - - require_once( "$IP/includes/Defines.php" ); - require_once( "/home/wikipedia/common/php-1.4/CommonSettings.php" ); -} else { - $wgWikiFarm = false; - $settingsFile = "$IP/LocalSettings.php"; - - if ( ! is_readable( $settingsFile ) ) { - print "A copy of your installation's LocalSettings.php\n" . - "must exist in the source directory.\n"; - exit(); + public function execute() { + global $args, $options; + $args = $this->mArgs; + $options = $this->mOptions; } - $wgCommandLineMode = true; - $DP = $IP; - require_once( "$IP/includes/Defines.php" ); - require_once( $settingsFile ); - ini_set( "include_path", ".$sep$IP$sep$IP/includes$sep$IP/languages$sep$IP/maintenance" ); - require_once( "$IP/AdminSettings.php" ); } -# Turn off output buffering again, it might have been turned on in the settings files -@ob_end_flush(); -# Same with these -$wgCommandLineMode = true; -$wgDBuser = $wgDBadminuser; -$wgDBpassword = $wgDBadminpassword; - +$maintClass = 'CommandLineInc'; +require( DO_MAINTENANCE ); -require_once( "Setup.php" ); -require_once( "install-utils.inc" ); -$wgTitle = Title::newFromText( "Command line script" ); -set_time_limit(0); -?> \ No newline at end of file