Tweaks to WikimediaMaintenance:
authorChad Horohoe <demon@users.mediawiki.org>
Thu, 8 Sep 2011 00:35:16 +0000 (00:35 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Thu, 8 Sep 2011 00:35:16 +0000 (00:35 +0000)
* Rename Site to WMFSite, less likely to conflict
* Create generic inclusion point for these scripts, so they don't have to duplicate the $IP detection
* Make them all subclass WikimediaMaintenance and move some of the wmf-specific hacks out of core -- almost resolved this crap :D
* Fix rebuildInterwiki to be protocol-relative (like r96139)
* By the way: rebuildInterwiki and dumpInterwiki seem awfully alike...maybe we can merge the two :)

maintenance/Maintenance.php
maintenance/doMaintenance.php

index a149603..adccee1 100644 (file)
@@ -890,57 +890,6 @@ abstract class Maintenance {
                }
        }
 
-       /**
-        * Do setup specific to WMF
-        */
-       public function loadWikimediaSettings() {
-               global $IP, $wgNoDBParam, $wgUseNormalUser, $wgConf, $site, $lang;
-
-               if ( empty( $wgNoDBParam ) ) {
-                       # Check if we were passed a db name
-                       if ( isset( $this->mOptions['wiki'] ) ) {
-                               $db = $this->mOptions['wiki'];
-                       } else {
-                               $db = array_shift( $this->mArgs );
-                       }
-                       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( $this->mArgs[0] ) ) {
-                                       $site = array_shift( $this->mArgs );
-                               } 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' ) {
-               # if ( posix_geteuid() == 48 ) {
-                       $wgUseNormalUser = true;
-               }
-
-               putenv( 'wikilang=' . $lang );
-
-               ini_set( 'include_path', ".:$IP:$IP/includes:$IP/languages:$IP/maintenance" );
-
-               if ( $lang == 'test' && $site == 'wikipedia' ) {
-                       if ( !defined( 'TESTWIKI' ) ) {
-                               define( 'TESTWIKI', 1 );
-                       }
-               }
-       }
-
        /**
         * Generic setup for most installs. Returns the location of LocalSettings
         * @return String
index 44e0003..e8fe07e 100644 (file)
@@ -82,11 +82,9 @@ if ( defined( 'MW_CONFIG_CALLBACK' ) ) {
        global $cluster;
        $cluster = 'pmtpa';
        require( MWInit::interpretedPath( '../wmf-config/wgConf.php' ) );
-       $maintenance->loadWikimediaSettings();
-       require( MWInit::interpretedPath( '../wmf-config/CommonSettings.php' ) );
-} else {
-       require_once( $maintenance->loadSettings() );
 }
+// Require the configuration (probably LocalSettings.php)
+require( MWInit::interpretedPath( $maintenance->loadSettings() ) );
 
 if ( $maintenance->getDbType() === Maintenance::DB_ADMIN &&
        is_readable( "$IP/AdminSettings.php" ) )