43 parent::__construct(
'wgUser' );
84 self::$destructorDeprecationDisarmed =
true;
89 self::$destructorDeprecationDisarmed =
false;
102 return $globalUser->realUser;
103 } elseif ( $globalUser instanceof
User ) {
106 throw new InvalidArgumentException(
107 '$globalUser must be a User (or StubGlobalUser), got ' .
108 ( is_object( $globalUser ) ? get_class( $globalUser ) : gettype( $globalUser ) )
131 public function _unstub( $name =
'_unstub', $level = 2 ) {
132 if ( !$GLOBALS[$this->global] instanceof
self ) {
133 return $GLOBALS[$this->global];
137 wfDebug(
"Unstubbing \${$this->global} on call of "
138 .
"\${$this->global}::$name from $caller" );
139 $GLOBALS[$this->global] = $this->_newObject();
140 return $GLOBALS[$this->global];
144 if ( !self::$destructorDeprecationDisarmed ) {
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
wfGetCaller( $level=2)
Get the name of the function which called this function wfGetCaller( 1 ) is the function with the wfG...
wfDeprecatedMsg( $msg, $version=false, $component=false, $callerOffset=2)
Log a deprecation warning with arbitrary message text.
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Logs a warning that a deprecated feature was used.
if(!defined('MW_SETUP_CALLBACK'))
The persistent session ID (if any) loaded at startup.
Stub object for the global user ($wgUser) that makes it possible to change the relevant underlying ob...
static bool $destructorDeprecationDisarmed
static getRealUser( $globalUser)
Get the relevant "real" user object based on either a User object or a StubGlobalUser wrapper.
__construct(User $realUser)
_unstub( $name='_unstub', $level=2)
This function creates a new object of the real class and replace it in the global variable.
static setUser( $user)
Reset the stub global user to a different "real" user object, while ensuring that any method calls on...
Class to implement stub globals, which are globals that delay loading the their associated module cod...