https://bugzilla.wikimedia.org/show_bug.cgi?id=41956
Web browser: ---
Bug #: 41956
Summary: Document how to implement tokens in (extension) api
modules
Product: MediaWiki
Version: 1.21-git
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: Unprioritized
Component: API
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected], [email protected],
[email protected], [email protected]
Classification: Unclassified
Mobile Platform: ---
Currently I'm using code like this:
// Before MW 1.20
$wgHooks['ApiTokensGetTokenTypes'][] =
'ApiTranslationReview::injectTokenFunction';
// After MW 1.20
$wgHooks['APIQueryInfoTokens'][] = 'ApiTranslationReview::injectTokenFunction';
public static function getToken() {
global $wgUser;
if ( !$wgUser->isAllowed( self::$right ) ) {
return false;
}
return $wgUser->getEditToken( self::$salt );
}
public static function injectTokenFunction( &$list ) {
$list['translationreview'] = array( __CLASS__, 'getToken' );
return true; // Hooks must return bool
}
However, I'd like to get rid of the global wgUser. Please document the best way
to implement tokens for version 1.19 and above.
--
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l