From 321de8502c2535467729b9da8aa579a21a14c92e Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Thu, 8 Sep 2011 00:35:16 +0000 Subject: [PATCH] Tweaks to WikimediaMaintenance: * 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 | 51 ----------------------------------- maintenance/doMaintenance.php | 6 ++--- 2 files changed, 2 insertions(+), 55 deletions(-) diff --git a/maintenance/Maintenance.php b/maintenance/Maintenance.php index a1496034df..adccee197a 100644 --- a/maintenance/Maintenance.php +++ b/maintenance/Maintenance.php @@ -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 diff --git a/maintenance/doMaintenance.php b/maintenance/doMaintenance.php index 44e00032db..e8fe07e6ac 100644 --- a/maintenance/doMaintenance.php +++ b/maintenance/doMaintenance.php @@ -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" ) ) -- 2.20.1