+if (!isset( $wgUseNormalUser ) ) {
+ $wgUseNormalUser = false;
+}
+
+if ( file_exists( '/home/wikipedia/common/langlist' ) ) {
+ $wgWikiFarm = true;
+ require_once( "$IP/includes/SiteConfiguration.php" );
+
+ # Get $conf
+ require( "$IP/InitialiseSettings.php" );
+
+ if ( empty( $wgNoDBParam ) ) {
+ # Check if we were passed a db name
+ $db = array_shift( $args );
+ list( $site, $lang ) = $wgConf->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";
+ }
+ }
+ } else {
+ $lang = "aa";
+ $site = "wikipedia";
+ }
+
+ # 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" ) {
+ $wgUseNormalUser = 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( "$IP/CommonSettings.php" );
+
+ if ( !$wgUseNormalUser ) {
+ $wgDBuser = $wgDBadminuser = "wikiadmin";
+ $wgDBpassword = $wgDBadminpassword = trim(`wikiadmin_pass`);
+ }
+} 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();
+ }
+ $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" );
+
+ if ( is_readable( "$IP/AdminSettings.php" ) ) {
+ 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