-$optionsWithArgs[] = 'conf'; # For specifying the location of LocalSettings.php
-$optionsWithArgs[] = 'aconf'; # As above for AdminSettings.php
-
-$self = array_shift( $argv );
-$IP = realpath( dirname( __FILE__ ) . '/..' );
-#chdir( $IP );
-require_once( "$IP/StartProfiler.php" );
-
-$options = array();
-$args = array();
-
-
-# Parse arguments
-for( $arg = reset( $argv ); $arg !== false; $arg = next( $argv ) ) {
- if ( $arg == '--' ) {
- # End of options, remainder should be considered arguments
- $arg = next( $argv );
- while( $arg !== false ) {
- $args[] = $arg;
- $arg = next( $argv );
- }
- break;
- } elseif ( substr( $arg, 0, 2 ) == '--' ) {
- # Long options
- $option = substr( $arg, 2 );
- if ( in_array( $option, $optionsWithArgs ) ) {
- $param = next( $argv );
- if ( $param === false ) {
- echo "$arg needs an value after it\n";
- die( -1 );
- }
- $options[$option] = $param;
- } else {
- $bits = explode( '=', $option, 2 );
- if( count( $bits ) > 1 ) {
- $option = $bits[0];
- $param = $bits[1];
- } else {
- $param = 1;
- }
- $options[$option] = $param;
- }
- } elseif ( substr( $arg, 0, 1 ) == '-' ) {
- # Short options
- for ( $p=1; $p<strlen( $arg ); $p++ ) {
- $option = $arg{$p};
- if ( in_array( $option, $optionsWithArgs ) ) {
- $param = next( $argv );
- if ( $param === false ) {
- echo "$arg needs an value after it\n";
- die( -1 );
- }
- $options[$option] = $param;
- } else {
- $options[$option] = 1;
- }
- }
- } else {
- $args[] = $arg;
- }
-}
-
-
-# General initialisation
-
-$wgCommandLineMode = true;
-# Turn off output buffering if it's on
-@ob_end_flush();
-$sep = PATH_SEPARATOR;
-
-if (!isset( $wgUseNormalUser ) ) {
- $wgUseNormalUser = false;
-}
-
-if ( file_exists( '/home/wikipedia/common/langlist' ) ) {
- $wgWikiFarm = true;
- $cluster = trim( file_get_contents( '/etc/cluster' ) );
- require_once( "$IP/includes/SiteConfiguration.php" );