42 $this->
addWarning( [
'apiwarn-tokens-origin' ] );
54 foreach ( $params[
'type'] as
$type ) {
56 $fit = $this->
getResult()->addValue(
$path, $type .
'token', $token );
61 array_diff( $params[
'type'], $done ) );
83 'rollback' =>
'rollback',
84 'userrights' =>
'userrights',
85 'login' => [
'',
'login' ],
86 'createaccount' => [
'',
'createaccount' ],
88 $hookContainer = MediaWikiServices::getInstance()->getHookContainer();
90 $hookRunner->onApiQueryTokensRegisterTypes( $salts );
110 if ( is_array( $salt ) ) {
112 return $session->getToken( ...$salt );
121 ParamValidator::PARAM_DEFAULT =>
'csrf',
122 ParamValidator::PARAM_ISMULTI =>
true,
123 ParamValidator::PARAM_TYPE => array_keys( self::getTokenTypeSalts() ),
124 ParamValidator::PARAM_ALL =>
true,
131 'action=query&meta=tokens'
132 =>
'apihelp-query+tokens-example-simple',
133 'action=query&meta=tokens&type=watch|patrol'
134 =>
'apihelp-query+tokens-example-types',
144 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.
lacksSameOriginSecurity()
Returns true if the current request breaks the same-origin policy.
This is a base class for all Query modules.
setContinueEnumParameter( $paramName, $paramValue)
Set a query-continue value.
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.
getHelpUrls()
Return links to more detailed help pages about the module.
isReadMode()
Indicates whether this module requires read rights.
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.
getEditTokenObject( $salt='', $request=null)
Initialize (if necessary) and return a session token value which can be used in edit forms to show th...