Go to the documentation of this file.
41 $this->
addWarning( [
'apiwarn-tokens-origin' ] );
48 foreach ( $params[
'type'] as
$type ) {
70 'rollback' =>
'rollback',
71 'userrights' =>
'userrights',
72 'login' => [
'',
'login' ],
73 'createaccount' => [
'',
'createaccount' ],
75 Hooks::run(
'ApiQueryTokensRegisterTypes', [ &$salts ] );
95 if ( is_array( $salt ) ) {
97 return $session->getToken( ...$salt );
115 'action=query&meta=tokens'
116 =>
'apihelp-query+tokens-example-simple',
117 'action=query&meta=tokens&type=watch|patrol'
118 =>
'apihelp-query+tokens-example-types',
132 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Tokens';
addWarning( $msg, $code=null, $data=null)
Add a warning for this module.
getCacheMode( $params)
Get the cache mode for the data generated by this module.
getEditTokenObject( $salt='', $request=null)
Initialize (if necessary) and return a session token value which can be used in edit forms to show th...
const META_TYPE
Key for the 'type' metadata item.
const PARAM_TYPE
(string|string[]) Either an array of allowed value strings, or a string type as described below.
getResult()
Get the result object.
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
lacksSameOriginSecurity()
Returns true if the current request breaks the same-origin policy.
Module to fetch tokens via action=query&meta=tokens.
isReadMode()
Indicates whether this module requires read rights.
This is a base class for all Query modules.
static getTokenTypeSalts()
Get the salts for known token types.
getHelpUrls()
Return links to more detailed help pages about the module.
extractRequestParams( $options=[])
Using getAllowedParams(), this function makes an array of the values provided by the user,...
getExamplesMessages()
Returns usage examples for this module.
static getToken(User $user, MediaWiki\Session\Session $session, $salt)
Get a token from a salt.
const PARAM_DFLT
(null|boolean|integer|string) Default value of the parameter.
getModuleName()
Get the name of the module being executed by this instance.
const PARAM_ISMULTI
(boolean) Accept multiple pipe-separated values for this parameter (e.g.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.