r96532 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r96531‎ | r96532 | r96533 >
Date:00:44, 8 September 2011
Author:demon
Status:ok
Tags:
Comment:
Followup r96529: forgot svn add
Modified paths:
  • /trunk/extensions/WikimediaMaintenance/WikimediaMaintenance.php (added) (history)

Diff [purge]

Index: trunk/extensions/WikimediaMaintenance/WikimediaMaintenance.php
@@ -0,0 +1,74 @@
 2+<?php
 3+/*
 4+ * Entry point for WikimediaMaintenance scripts :)
 5+ */
 6+
 7+// Detect $IP
 8+$IP = getenv( 'MW_INSTALL_PATH' );
 9+if ( $IP === false ) {
 10+ $IP = dirname( __FILE__ ) . '/../..';
 11+}
 12+
 13+// Require base maintenance class
 14+require( "$IP/maintenance/Maintenance.php" );
 15+
 16+// Some scripts need the WMFSite class, so include that too
 17+require( dirname( __FILE__ ) . '/WMFSite.php' );
 18+
 19+/**
 20+ * Wikimedia-specific maintenance classes should extend this. This class will
 21+ * override some maintenance setup process to be wmf-specific.
 22+ */
 23+abstract class WikimediaMaintenance extends Maintenance {
 24+ /**
 25+ * Override the core loadSettings.
 26+ */
 27+ public function loadSettings() {
 28+ global $IP, $wgNoDBParam, $wgUseNormalUser, $wgConf, $site, $lang;
 29+
 30+ if ( empty( $wgNoDBParam ) ) {
 31+ # Check if we were passed a db name
 32+ if ( isset( $this->mOptions['wiki'] ) ) {
 33+ $db = $this->mOptions['wiki'];
 34+ } else {
 35+ $db = array_shift( $this->mArgs );
 36+ }
 37+ list( $site, $lang ) = $wgConf->siteFromDB( $db );
 38+
 39+ # If not, work out the language and site the old way
 40+ if ( is_null( $site ) || is_null( $lang ) ) {
 41+ if ( !$db ) {
 42+ $lang = 'aa';
 43+ } else {
 44+ $lang = $db;
 45+ }
 46+ if ( isset( $this->mArgs[0] ) ) {
 47+ $site = array_shift( $this->mArgs );
 48+ } else {
 49+ $site = 'wikipedia';
 50+ }
 51+ }
 52+ } else {
 53+ $lang = 'aa';
 54+ $site = 'wikipedia';
 55+ }
 56+
 57+ # This is for the IRC scripts, which now run as the apache user
 58+ # The apache user doesn't have access to the wikiadmin_pass command
 59+ if ( $_ENV['USER'] == 'apache' ) {
 60+ # if ( posix_geteuid() == 48 ) {
 61+ $wgUseNormalUser = true;
 62+ }
 63+
 64+ putenv( 'wikilang=' . $lang );
 65+
 66+ ini_set( 'include_path', ".:$IP:$IP/includes:$IP/languages:$IP/maintenance" );
 67+
 68+ if ( $lang == 'test' && $site == 'wikipedia' ) {
 69+ if ( !defined( 'TESTWIKI' ) ) {
 70+ define( 'TESTWIKI', 1 );
 71+ }
 72+ }
 73+ return '../wmf-config/CommonSettings.php';
 74+ }
 75+}
Property changes on: trunk/extensions/WikimediaMaintenance/WikimediaMaintenance.php
___________________________________________________________________
Added: svn:eol-style
176 + native

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r96529Tweaks to WikimediaMaintenance:...demon00:35, 8 September 2011

Status & tagging log