MediaWiki REL1_39
|
Stub object for the global user ($wgUser) that makes it possible to change the relevant underlying object while still ensuring that deprecation warnings will be emitted upon method calls. More...
Public Member Functions | |
__construct (User $realUser) | |
__destruct () | |
_newObject () | |
_unstub ( $name='_unstub', $level=2) | |
This function creates a new object of the real class and replace it in the global variable. | |
Public Member Functions inherited from StubObject | |
__call ( $name, $args) | |
Function called by PHP if no function with that name exists in this object. | |
__construct ( $global=null, $class=null, $params=[]) | |
__get ( $name) | |
Function called by PHP if no property with that name exists in this object. | |
__set ( $name, $value) | |
Function called by PHP if no property with that name exists in this object. | |
_call ( $name, $args) | |
Function called if any function exists with that name in this object. | |
_get ( $name) | |
Wrapper for __get(), similar to _call() above. | |
_set ( $name, $value) | |
Wrapper for __set(), similar to _call() above. | |
Static Public Member Functions | |
static | getRealUser ( $globalUser) |
Get the relevant "real" user object based on either a User object or a StubGlobalUser wrapper. | |
static | setUser ( $user) |
Reset the stub global user to a different "real" user object, while ensuring that any method calls on that object will still trigger deprecation notices. | |
Static Public Member Functions inherited from StubObject | |
static | isRealObject ( $obj) |
Returns a bool value whenever $obj is a stub object. | |
static | unstub (&$obj) |
Unstubs an object, if it is a stub object. | |
Public Attributes | |
User | $realUser |
Static Public Attributes | |
static bool | $destructorDeprecationDisarmed = false |
Additional Inherited Members | |
Protected Attributes inherited from StubObject | |
null string | $class |
null callable | $factory |
null string | $global |
array | $params |
Stub object for the global user ($wgUser) that makes it possible to change the relevant underlying object while still ensuring that deprecation warnings will be emitted upon method calls.
Definition at line 31 of file StubGlobalUser.php.
StubGlobalUser::__construct | ( | User | $realUser | ) |
StubGlobalUser::__destruct | ( | ) |
Definition at line 143 of file StubGlobalUser.php.
References wfDeprecatedMsg().
StubGlobalUser::_newObject | ( | ) |
Reimplemented from StubObject.
Definition at line 50 of file StubGlobalUser.php.
References $realUser, and wfDeprecated().
StubGlobalUser::_unstub | ( | $name = '_unstub', | |
$level = 2 ) |
This function creates a new object of the real class and replace it in the global variable.
This is public, for the convenience of external callers wishing to access properties, e.g. eval.php
Overriding StubObject::_unstub because for some reason that thinks there is an unstub loop when trying to use the magic __set() logic, but there isn't any loop because _newObject() returns a specific instance of User rather than calling any methods that could then try to use $wgUser. The main difference between this and the parent method is that we don't try to check for recursion loops.
string | $name | Name of the method called in this object. |
int | $level | Level to go in the stack trace to get the function who called this function. |
Reimplemented from StubObject.
Definition at line 131 of file StubGlobalUser.php.
References wfDebug(), and wfGetCaller().
|
static |
Get the relevant "real" user object based on either a User object or a StubGlobalUser wrapper.
Bypasses deprecation notices from converting a StubGlobalUser to an actual user, and does not change $wgUser.
StubGlobalUser | User | $globalUser |
Definition at line 100 of file StubGlobalUser.php.
Referenced by setUser().
|
static |
Reset the stub global user to a different "real" user object, while ensuring that any method calls on that object will still trigger deprecation notices.
StubGlobalUser | User | $user |
Definition at line 79 of file StubGlobalUser.php.
References $realUser, $wgUser, and getRealUser().
Referenced by ApiMain\__construct(), CleanupSpam\execute(), DeleteBatch\execute(), DeleteDefaultMessages\execute(), DeleteEqualMessages\execute(), EditCLI\execute(), ImportImages\execute(), ImportSiteScripts\execute(), MoveBatch\execute(), PPFuzzTest\execute(), Undelete\execute(), RequestContext\importScopedSession(), Installer\resetMediaWikiServices(), and LoginSignupSpecialPage\setSessionUserForCurrentRequest().
|
static |
Definition at line 34 of file StubGlobalUser.php.
User StubGlobalUser::$realUser |
Definition at line 37 of file StubGlobalUser.php.
Referenced by __construct(), _newObject(), and setUser().