Go to the documentation of this file.
38 if ( isset( $params[
'from'] ) ) {
40 if ( !$fromTitle || $fromTitle->isExternal() ) {
43 } elseif ( isset( $params[
'fromid'] ) ) {
46 $this->
dieWithError( [
'apierror-nosuchpageid', $params[
'fromid'] ] );
50 if ( isset( $params[
'to'] ) ) {
52 if ( !$toTitle || $toTitle->isExternal() ) {
55 } elseif ( isset( $params[
'toid'] ) ) {
58 $this->
dieWithError( [
'apierror-nosuchpageid', $params[
'toid'] ] );
62 $reason = $params[
'reason'];
63 $timestamp = $params[
'timestamp'];
66 $status = $this->
merge( $fromTitle, $toTitle, $timestamp, $reason );
72 'from' => $fromTitle->getPrefixedText(),
73 'to' => $toTitle->getPrefixedText(),
74 'timestamp' =>
wfTimestamp( TS_ISO_8601, $params[
'timestamp'] ),
75 'reason' => $params[
'reason']
92 return $mh->merge( $this->
getUser(), $reason );
126 'action=mergehistory&from=Oldpage&to=Newpage&token=123ABC&' .
128 =>
'apihelp-mergehistory-example-merge',
129 'action=mergehistory&from=Oldpage&to=Newpage&token=123ABC&' .
130 'reason=Reason×tamp=2015-12-31T04%3A37%3A41Z'
131 =>
'apihelp-mergehistory-example-merge-timestamp',
136 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Mergehistory';
API Module to merge page histories.
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
dieWithError( $msg, $code=null, $data=null, $httpCode=null)
Abort execution with an error.
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
const PARAM_TYPE
(string|string[]) Either an array of allowed value strings, or a string type as described below.
getResult()
Get the result object.
isWriteMode()
Indicates whether this module requires write mode.
getExamplesMessages()
Returns usage examples for this module.
This abstract class implements many basic API functions, and is the base of all API classes.
needsToken()
Returns the token type this module requires in order to execute.
mustBePosted()
Indicates whether this module must be called with a POST request.
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
extractRequestParams( $options=[])
Using getAllowedParams(), this function makes an array of the values provided by the user,...
merge(Title $from, Title $to, $timestamp, $reason)
getHelpUrls()
Return links to more detailed help pages about the module.
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,...
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
requireOnlyOneParameter( $params, $required)
Die if none or more than one of a certain set of parameters is set and not false.
Handles the backend logic of merging the histories of two pages.
Represents a title within MediaWiki.
dieStatus(StatusValue $status)
Throw an ApiUsageException based on the Status object.
getModuleName()
Get the name of the module being executed by this instance.
static newFromID( $id, $flags=0)
Create a new Title from an article ID.