summaryrefslogtreecommitdiff
path: root/includes/resourceloader/ResourceLoaderUserTokensModule.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2015-06-04 07:31:04 +0200
committerPierre Schmitz <pierre@archlinux.de>2015-06-04 07:58:39 +0200
commitf6d65e533c62f6deb21342d4901ece24497b433e (patch)
treef28adf0362d14bcd448f7b65a7aaf38650f923aa /includes/resourceloader/ResourceLoaderUserTokensModule.php
parentc27b2e832fe25651ef2410fae85b41072aae7519 (diff)
Update to MediaWiki 1.25.1
Diffstat (limited to 'includes/resourceloader/ResourceLoaderUserTokensModule.php')
-rw-r--r--includes/resourceloader/ResourceLoaderUserTokensModule.php13
1 files changed, 7 insertions, 6 deletions
diff --git a/includes/resourceloader/ResourceLoaderUserTokensModule.php b/includes/resourceloader/ResourceLoaderUserTokensModule.php
index 668467ca..ccd1dfd0 100644
--- a/includes/resourceloader/ResourceLoaderUserTokensModule.php
+++ b/includes/resourceloader/ResourceLoaderUserTokensModule.php
@@ -37,15 +37,16 @@ class ResourceLoaderUserTokensModule extends ResourceLoaderModule {
/**
* Fetch the tokens for the current user.
*
+ * @param ResourceLoaderContext $context
* @return array List of tokens keyed by token type
*/
- protected function contextUserTokens() {
- global $wgUser;
+ protected function contextUserTokens( ResourceLoaderContext $context ) {
+ $user = $context->getUserObj();
return array(
- 'editToken' => $wgUser->getEditToken(),
- 'patrolToken' => $wgUser->getEditToken( 'patrol' ),
- 'watchToken' => $wgUser->getEditToken( 'watch' ),
+ 'editToken' => $user->getEditToken(),
+ 'patrolToken' => $user->getEditToken( 'patrol' ),
+ 'watchToken' => $user->getEditToken( 'watch' ),
);
}
@@ -55,7 +56,7 @@ class ResourceLoaderUserTokensModule extends ResourceLoaderModule {
*/
public function getScript( ResourceLoaderContext $context ) {
return Xml::encodeJsCall( 'mw.user.tokens.set',
- array( $this->contextUserTokens() ),
+ array( $this->contextUserTokens( $context ) ),
ResourceLoader::inDebugMode()
);
}