Move $wgUseNormalUser setting to constructors.
authorChad Horohoe <demon@users.mediawiki.org>
Sun, 9 Aug 2009 12:26:11 +0000 (12:26 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Sun, 9 Aug 2009 12:26:11 +0000 (12:26 +0000)
maintenance/eval.php
maintenance/http_session_download.php

index c25c8d6..c5bfaf2 100644 (file)
@@ -35,15 +35,16 @@ require_once( dirname(__FILE__) . '/Maintenance.php' );
 class EvalPrompt extends Maintenance {
 
        public function __construct() {
+               global $wgUseNormalUser;
                parent::__construct();
                $this->mDescription = "This script lets a command-line user start up the wiki engine and then poke\n" .
                                                                "about by issuing PHP commands directly.";
                $this->addOption( 'd', "Enable MediaWiki debug output", false, true );
+               $wgUseNormalUser = (bool)getenv('MW_WIKIUSER');
        }
        
        public function execute() {
-               global $wgUseNormalUser, $wgDebugFunctionEntry, $wgDebugLogFile;
-               $wgUseNormalUser = (bool)getenv('MW_WIKIUSER');
+               global $wgDebugFunctionEntry, $wgDebugLogFile;
                if ( $this->hasOption('d') ) {
                        $d = $this->getOption('d');
                        if ( $d > 0 ) {
index 264c8af..3abaaf6 100644 (file)
@@ -27,19 +27,18 @@ require_once( dirname(__FILE__) . '/Maintenance.php' );
 
 class HttpSessionDownload extends Maintenance {
        public function __construct() {
+               global $wgUseNormalUser;
                parent::__construct();
                $this->mDescription = "Simple entry point to initiate a background download";
                $this->addOption( 'sid', 'Session ID', true, true );
                $this->addOption( 'usk', 'Upload session key', true, true );
+               $wgUseNormalUser = true;
        }
        
        public function execute() {
-               global $wgUseNormalUser;
+               
                wfProfileIn(__METHOD__);
 
-               // act like a "normal user"
-               $wgUseNormalUser = true;
-
                //run the download: 
                Http::doSessionIdDownload( $this->getOption('sid'), $this->getOption('usk') );