40 ApiResult::META_TYPE =>
'assoc',
44 $this->
addWarning( [
'apiwarn-tokens-origin' ] );
51 foreach ( $params[
'type'] as
$type ) {
73 'rollback' =>
'rollback',
74 'userrights' =>
'userrights',
75 'login' => [
'',
'login' ],
76 'createaccount' => [
'',
'createaccount' ],
78 $hookContainer = MediaWikiServices::getInstance()->getHookContainer();
100 if ( is_array( $salt ) ) {
102 return $session->getToken( ...$salt );
120 'action=query&meta=tokens'
121 =>
'apihelp-query+tokens-example-simple',
122 'action=query&meta=tokens&type=watch|patrol'
123 =>
'apihelp-query+tokens-example-types',
137 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Tokens';
getResult()
Get the result object.
extractRequestParams( $options=[])
Using getAllowedParams(), this function makes an array of the values provided by the user,...
addWarning( $msg, $code=null, $data=null)
Add a warning for this module.
getModuleName()
Get the name of the module being executed by this instance.
HookContainer $hookContainer
ApiHookRunner $hookRunner
lacksSameOriginSecurity()
Returns true if the current request breaks the same-origin policy.
This is a base class for all Query modules.
Module to fetch tokens via action=query&meta=tokens.
static getTokenTypeSalts()
Get the salts for known token types.
static getToken(User $user, MediaWiki\Session\Session $session, $salt)
Get a token from a salt.
getCacheMode( $params)
Get the cache mode for the data generated by this module.
getHelpUrls()
Return links to more detailed help pages about the module.
isReadMode()
Indicates whether this module requires read rights Stable to override.
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
getExamplesMessages()
Returns usage examples for this module.
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
getUser()
Stable to override.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
getEditTokenObject( $salt='', $request=null)
Initialize (if necessary) and return a session token value which can be used in edit forms to show th...