Get rid of StubUser. Constructing a user object isn't quite as intensive as it once...
authorChad Horohoe <demon@users.mediawiki.org>
Thu, 12 Aug 2010 17:10:00 +0000 (17:10 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Thu, 12 Aug 2010 17:10:00 +0000 (17:10 +0000)
includes/AutoLoader.php
includes/Setup.php
includes/StubObject.php

index 52b6bd5..a42398a 100644 (file)
@@ -214,7 +214,6 @@ $wgAutoloadLocalClasses = array(
        'SquidPurgeClientPool' => 'includes/SquidPurgeClient.php',
        'Status' => 'includes/Status.php',
        'StubContLang' => 'includes/StubObject.php',
-       'StubUser' => 'includes/StubObject.php',
        'StubUserLang' => 'includes/StubObject.php',
        'StubObject' => 'includes/StubObject.php',
        'StringUtils' => 'includes/StringUtils.php',
index d9777e2..fa3296d 100644 (file)
@@ -322,8 +322,7 @@ $wgContLang = new StubContLang;
 
 // Now that variant lists may be available...
 $wgRequest->interpolateTitle();
-
-$wgUser = new StubUser;
+$wgUser = $wgCommandLineMode ? new User : User::newFromSession();
 $wgLang = new StubUserLang;
 $wgOut = new StubObject( 'wgOut', 'OutputPage' );
 $wgParser = new StubObject( 'wgParser', $wgParserConf['class'], array( $wgParserConf ) );
index c93e3fc..fe28f91 100644 (file)
@@ -165,30 +165,3 @@ class StubUserLang extends StubObject {
                }
        }
 }
-
-/**
- * Stub object for the user. The initialisation of the will depend of
- * $wgCommandLineMode. If it's true, it will be an anonymous user and if it's
- * false, the user will be loaded from credidentails provided by cookies. This
- * object have to be in $wgUser global.
- */
-class StubUser extends StubObject {
-
-       function __construct() {
-               parent::__construct( 'wgUser' );
-       }
-
-       function __call( $name, $args ) {
-               return $this->_call( $name, $args );
-       }
-
-       function _newObject() {
-               global $wgCommandLineMode;
-               if( $wgCommandLineMode ) {
-                       $user = new User;
-               } else {
-                       $user = User::newFromSession();
-               }
-               return $user;
-       }
-}