Go to the documentation of this file.
57 if ( !$tagStatus->isOK() ) {
76 $watch =
'preferences';
77 if ( isset(
$params[
'watchlist'] ) ) {
82 $this->
setWatch( $watch, $titleObj,
'watchrollback' );
85 'title' => $titleObj->getPrefixedText(),
86 'pageid' => intval( $details[
'current']->getPage() ),
87 'summary' => $details[
'summary'],
88 'revid' => intval( $details[
'newid'] ),
90 'old_revid' => intval( $details[
'current']->getID() ),
92 'last_revid' => intval( $details[
'target']->getID() )
148 if ( $this->mUser !==
null ) {
156 if ( !$this->mUser ) {
169 if ( $this->mTitleObj !==
null ) {
175 if ( isset(
$params[
'title'] ) ) {
177 if ( !$this->mTitleObj || $this->mTitleObj->isExternal() ) {
180 } elseif ( isset(
$params[
'pageid'] ) ) {
182 if ( !$this->mTitleObj ) {
183 $this->
dieWithError( [
'apierror-nosuchpageid', $params[
'pageid'] ] );
187 if ( !$this->mTitleObj->exists() ) {
196 'action=rollback&title=Main%20Page&user=Example&token=123ABC' =>
197 'apihelp-rollback-example-simple',
198 'action=rollback&title=Main%20Page&user=192.0.2.5&' .
199 'token=123ABC&summary=Reverting%20vandalism&markbot=1' =>
200 'apihelp-rollback-example-summary',
205 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Rollback';
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
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
const PARAM_REQUIRED
(boolean) Is the parameter required?
dieWithError( $msg, $code=null, $data=null, $httpCode=null)
Abort execution with an error.
const PARAM_TYPE
(string|string[]) Either an array of allowed value strings, or a string type as described below.
getResult()
Get the result object.
getUser()
Get the User object.
const PARAM_HELP_MSG_APPEND
((string|array|Message)[]) Specify additional i18n messages to append to the normal message for this ...
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
This abstract class implements many basic API functions, and is the base of all API classes.
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
mustBePosted()
Indicates whether this module must be called with a POST request.
getExamplesMessages()
Returns usage examples for this module.
static factory(Title $title)
Create a WikiPage object of the appropriate class for the given title.
isWriteMode()
Indicates whether this module requires write mode.
getRbTitle(array $params)
static isIP( $name)
Does the string match an anonymous IP address?
setWatch( $watch, $titleObj, $userOption=null)
Set a watch (or unwatch) based the based on a watchlist parameter.
extractRequestParams( $parseLimit=true)
Using getAllowedParams(), this function makes an array of the values provided by the user,...
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 incomplete not yet checked for validity & $retval
useTransactionalTimeLimit()
Call wfTransactionalTimeLimit() if this request was POSTed.
wfEscapeWikiText( $text)
Escapes the given text so that it may be output using addWikiText() without any linking,...
requireOnlyOneParameter( $params, $required)
Die if none or more than one of a certain set of parameters is set and not false.
getHelpUrls()
Return links to more detailed help pages about the module.
Represents a title within MediaWiki.
needsToken()
Returns the token type this module requires in order to execute.
static getCanonicalName( $name, $validate='valid')
Given unvalidated user input, return a canonical username, or false if the username is invalid.
const PARAM_DFLT
(null|boolean|integer|string) Default value of the parameter.
dieStatus(StatusValue $status)
Throw an ApiUsageException based on the Status object.
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.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return true
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
static newFromID( $id, $flags=0)
Create a new Title from an article ID.
errorArrayToStatus(array $errors, User $user=null)
Turn an array of message keys or key+param arrays into a Status.
the array() calling protocol came about after MediaWiki 1.4rc1.