44 parent::__construct( $mainModule, $moduleName );
45 $this->mergeHistoryFactory = $mergeHistoryFactory;
57 if ( isset(
$params[
'from'] ) ) {
58 $fromTitle = Title::newFromText(
$params[
'from'] );
59 if ( !$fromTitle || $fromTitle->isExternal() ) {
62 } elseif ( isset(
$params[
'fromid'] ) ) {
63 $fromTitle = Title::newFromID(
$params[
'fromid'] );
70 $toTitle = Title::newFromText(
$params[
'to'] );
71 if ( !$toTitle || $toTitle->isExternal() ) {
74 } elseif ( isset(
$params[
'toid'] ) ) {
75 $toTitle = Title::newFromID(
$params[
'toid'] );
82 $timestamp =
$params[
'timestamp'];
86 $status = $this->
merge( $fromTitle, $toTitle, $timestamp, $reason );
87 if ( !$status->isOK() ) {
93 'from' => $fromTitle->getPrefixedText(),
95 'to' => $toTitle->getPrefixedText(),
112 $mh = $this->mergeHistoryFactory->newMergeHistory( $from, $to, $timestamp );
129 ParamValidator::PARAM_TYPE =>
'integer'
133 ParamValidator::PARAM_TYPE =>
'integer'
136 ParamValidator::PARAM_TYPE =>
'timestamp'
148 'action=mergehistory&from=Oldpage&to=Newpage&token=123ABC&' .
150 =>
'apihelp-mergehistory-example-merge',
151 'action=mergehistory&from=Oldpage&to=Newpage&token=123ABC&' .
152 'reason=Reason×tamp=2015-12-31T04%3A37%3A41Z'
153 =>
'apihelp-mergehistory-example-merge-timestamp',
158 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Mergehistory';
163class_alias( ApiMergeHistory::class,
'ApiMergeHistory' );
wfEscapeWikiText( $input)
Escapes the given text so that it may be output using addWikiText() without any linking,...
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
array $params
The job parameters.
This is the main API class, used for both external and internal processing.
API Module to merge page histories.
isWriteMode()
Indicates whether this module requires write access to the wiki.
getExamplesMessages()
Returns usage examples for this module.
__construct(ApiMain $mainModule, string $moduleName, MergeHistoryFactory $mergeHistoryFactory)
getHelpUrls()
Return links to more detailed help pages about the module.
mustBePosted()
Indicates whether this module must be called with a POST request.
merge(PageIdentity $from, PageIdentity $to, $timestamp, $reason)
needsToken()
Returns the token type this module requires in order to execute.
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
Service for mergehistory actions.
Interface for objects (potentially) representing an editable wiki page.