From 495ea205640cc3594623e458ef3e5832e4bbd81f Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Mon, 13 Dec 2010 15:30:41 +0000 Subject: [PATCH] Fix for r75858: Move $IP detection further up so it can be used in child constructors --- maintenance/Maintenance.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/maintenance/Maintenance.php b/maintenance/Maintenance.php index 2c96c5260a..e1e0098a99 100644 --- a/maintenance/Maintenance.php +++ b/maintenance/Maintenance.php @@ -102,10 +102,16 @@ abstract class Maintenance { protected static $mCoreScripts = null; /** - * Default constructor. Children should call this if implementing + * Default constructor. Children should call this *first* if implementing * their own constructors */ public function __construct() { + // Setup $IP, using MW_INSTALL_PATH if it exists + global $IP; + $IP = strval( getenv( 'MW_INSTALL_PATH' ) ) !== '' + ? getenv( 'MW_INSTALL_PATH' ) + : realpath( dirname( __FILE__ ) . '/..' ); + $this->addDefaultParams(); register_shutdown_function( array( $this, 'outputChanneled' ), false ); } @@ -415,7 +421,7 @@ abstract class Maintenance { * Do some sanity checking and basic setup */ public function setup() { - global $IP, $wgCommandLineMode, $wgRequestTime; + global $wgCommandLineMode, $wgRequestTime; # Abort if called from a web server if ( isset( $_SERVER ) && isset( $_SERVER['REQUEST_METHOD'] ) ) { @@ -459,11 +465,6 @@ abstract class Maintenance { # Define us as being in MediaWiki define( 'MEDIAWIKI', true ); - # Setup $IP, using MW_INSTALL_PATH if it exists - $IP = strval( getenv( 'MW_INSTALL_PATH' ) ) !== '' - ? getenv( 'MW_INSTALL_PATH' ) - : realpath( dirname( __FILE__ ) . '/..' ); - $wgCommandLineMode = true; # Turn off output buffering if it's on @ob_end_flush(); -- 2.20.1