Go to the documentation of this file.
43 $this->
addWarning( [
'apiwarn-tokens-origin' ] );
72 'rollback' =>
'rollback',
73 'userrights' =>
'userrights',
74 'login' => [
'',
'login' ],
75 'createaccount' => [
'',
'createaccount' ],
77 Hooks::run(
'ApiQueryTokensRegisterTypes', [ &$salts ] );
97 if ( is_array( $salt ) ) {
99 return call_user_func_array( [ $session,
'getToken' ], $salt );
101 return $user->getEditTokenObject( $salt, $session->getRequest() );
117 'action=query&meta=tokens'
118 =>
'apihelp-query+tokens-example-simple',
119 'action=query&meta=tokens&type=watch|patrol'
120 =>
'apihelp-query+tokens-example-types',
134 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Tokens';
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account $user
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.
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...
getRequest()
Get the WebRequest object.
getUser()
Get the User object.
lacksSameOriginSecurity()
Returns true if the current request breaks the same-origin policy.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
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( $parseLimit=true)
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.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
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.