55 if ( count(
$params[
'tags'] ) ) {
57 if ( !$tagStatus->isOK() ) {
75 (
$retval[0][0] ==
'alreadyrolled' ||
$retval[0][0] ==
'cantrollback' )
78 $userMessage = $this->
msg( $error[0], array_slice( $error, 1 ) );
80 $errorCode = $error[0];
84 $this->
dieUsage( $errorInfo, $errorCode, 0, [
85 'messageHtml' => $userMessage->parseAsBlock()
92 $watch =
'preferences';
93 if ( isset(
$params[
'watchlist'] ) ) {
98 $this->
setWatch( $watch, $titleObj,
'watchrollback' );
101 'title' => $titleObj->getPrefixedText(),
102 'pageid' => intval( $details[
'current']->getPage() ),
103 'summary' => $details[
'summary'],
104 'revid' => intval( $details[
'newid'] ),
106 'old_revid' => intval( $details[
'current']->getID() ),
108 'last_revid' => intval( $details[
'target']->getID() )
113 $diffUrl = $titleObj->getFullURL( [
114 'diff' => $info[
'revid'],
115 'oldid' => $info[
'old_revid'],
118 $info[
'messageHtml'] = $this->
msg(
'rollback-success-notify' )
119 ->params( $oldUser, $lastUser, $diffUrl )
175 if ( $this->mUser !== null ) {
183 if ( !$this->mUser ) {
184 $this->
dieUsageMsg( [
'invaliduser', $params[
'user'] ] );
196 if ( $this->mTitleObj !== null ) {
202 if ( isset( $params[
'title'] ) ) {
204 if ( !$this->mTitleObj || $this->mTitleObj->isExternal() ) {
205 $this->
dieUsageMsg( [
'invalidtitle', $params[
'title'] ] );
207 } elseif ( isset( $params[
'pageid'] ) ) {
209 if ( !$this->mTitleObj ) {
210 $this->
dieUsageMsg( [
'nosuchpageid', $params[
'pageid'] ] );
214 if ( !$this->mTitleObj->exists() ) {
223 'action=rollback&title=Main%20Page&user=Example&token=123ABC' =>
224 'apihelp-rollback-example-simple',
225 'action=rollback&title=Main%20Page&user=192.0.2.5&' .
226 'token=123ABC&summary=Reverting%20vandalism&markbot=1' =>
227 'apihelp-rollback-example-summary',
232 return 'https://www.mediawiki.org/wiki/API:Rollback';
static factory(Title $title)
Create a WikiPage object of the appropriate class for the given title.
static newFromID($id, $flags=0)
Create a new Title from an article ID.
const PARAM_TYPE
(string|string[]) Either an array of allowed value strings, or a string type as described below...
the array() calling protocol came about after MediaWiki 1.4rc1.
getResult()
Get the result object.
static $messageMap
Array that maps message keys to error messages.
static getCanonicalName($name, $validate= 'valid')
Given unvalidated user input, return a canonical username, or false if the username is invalid...
useTransactionalTimeLimit()
Call wfTransactionalTimeLimit() if this request was POSTed.
const PARAM_DFLT
(null|boolean|integer|string) Default value of the parameter.
setWatch($watch, $titleObj, $userOption=null)
Set a watch (or unwatch) based the based on a watchlist parameter.
const PARAM_REQUIRED
(boolean) Is the parameter required?
extractRequestParams($parseLimit=true)
Using getAllowedParams(), this function makes an array of the values provided by the user...
requireOnlyOneParameter($params, $required)
Die if none or more than one of a certain set of parameters is set and not false. ...
static newFromText($text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
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
const PARAM_HELP_MSG_APPEND
((string|array|Message)[]) Specify additional i18n messages to append to the normal message for this ...
msg()
Get a Message object with context set Parameters are the same as wfMessage()
getRbTitle(array $params)
static isIP($name)
Does the string match an anonymous IP address?
getModuleName()
Get the name of the module being executed by this instance.
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 local account $user
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
const PARAM_ISMULTI
(boolean) Accept multiple pipe-separated values for this parameter (e.g.
dieUsage($description, $errorCode, $httpRespCode=0, $extradata=null)
Throw a UsageException, which will (if uncaught) call the main module's error handler and die with an...
This abstract class implements many basic API functions, and is the base of all API classes...
dieStatus($status)
Throw a UsageException based on the errors in the Status object.
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 local account incomplete not yet checked for validity & $retval
getUser()
Get the User object.
dieUsageMsg($error)
Output the error message related to a certain array.