45 $pageObj = WikiPage::factory( $titleObj );
52 $tagStatus = ChangeTags::canAddTagsAccompanyingChange(
$params[
'tags'], $user );
53 if ( !$tagStatus->isOK() ) {
72 $watch =
'preferences';
73 if ( isset(
$params[
'watchlist'] ) ) {
78 $this->
setWatch( $watch, $titleObj,
'watchrollback' );
81 'title' => $titleObj->getPrefixedText(),
82 'pageid' => intval( $details[
'current']->getPage() ),
83 'summary' => $details[
'summary'],
84 'revid' => intval( $details[
'newid'] ),
86 'old_revid' => intval( $details[
'current']->getID() ),
88 'last_revid' => intval( $details[
'target']->getID() )
144 if ( $this->mUser !==
null ) {
152 if ( !$this->mUser ) {
165 if ( $this->mTitleObj !==
null ) {
171 if ( isset(
$params[
'title'] ) ) {
172 $this->mTitleObj = Title::newFromText(
$params[
'title'] );
173 if ( !$this->mTitleObj || $this->mTitleObj->isExternal() ) {
176 } elseif ( isset(
$params[
'pageid'] ) ) {
177 $this->mTitleObj = Title::newFromID(
$params[
'pageid'] );
178 if ( !$this->mTitleObj ) {
179 $this->
dieWithError( [
'apierror-nosuchpageid', $params[
'pageid'] ] );
183 if ( !$this->mTitleObj->exists() ) {
192 'action=rollback&title=Main%20Page&user=Example&token=123ABC' =>
193 'apihelp-rollback-example-simple',
194 'action=rollback&title=Main%20Page&user=192.0.2.5&' .
195 'token=123ABC&summary=Reverting%20vandalism&markbot=1' =>
196 'apihelp-rollback-example-summary',
201 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Rollback';
wfEscapeWikiText( $text)
Escapes the given text so that it may be output using addWikiText() without any linking,...
This abstract class implements many basic API functions, and is the base of all API classes.
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.
setWatch( $watch, $titleObj, $userOption=null)
Set a watch (or unwatch) based the based on a watchlist parameter.
const PARAM_DFLT
(null|boolean|integer|string) Default value of the parameter.
const PARAM_HELP_MSG_APPEND
((string|array|Message)[]) Specify additional i18n messages to append to the normal message for this ...
errorArrayToStatus(array $errors, User $user=null)
Turn an array of message keys or key+param arrays into a Status.
getResult()
Get the result object.
extractRequestParams( $options=[])
Using getAllowedParams(), this function makes an array of the values provided by the user,...
getModuleName()
Get the name of the module being executed by this instance.
dieStatus(StatusValue $status)
Throw an ApiUsageException based on the Status object.
useTransactionalTimeLimit()
Call wfTransactionalTimeLimit() if this request was POSTed.
requireOnlyOneParameter( $params, $required)
Die if none or more than one of a certain set of parameters is set and not false.
const PARAM_ISMULTI
(boolean) Accept multiple pipe-separated values for this parameter (e.g.
getRbTitle(array $params)
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
getHelpUrls()
Return links to more detailed help pages about the module.
isWriteMode()
Indicates whether this module requires write mode.
getExamplesMessages()
Returns usage examples for this module.
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.
needsToken()
Returns the token type this module requires in order to execute.
Represents a title within MediaWiki.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
static getCanonicalName( $name, $validate='valid')
Given unvalidated user input, return a canonical username, or false if the username is invalid.
static isIP( $name)
Does the string match an anonymous IP address?
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
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
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))