$last = $this->message['last'];
$ts = wfTimestamp( TS_MW, $row->rev_timestamp );
- $checkBox = Xml::radio( 'mergepoint', $ts, false );
+ $checkBox = Xml::radio( 'mergepoint', $ts, ( $this->mTimestamp === $ts ) );
$user = $this->getUser();
->rawParams( $checkBox, $last, $pageLink, $userLink, $stxt, $comment )->escaped() );
}
+ /**
+ * Actually attempt the history move
+ *
+ * @todo: if all versions of page A are moved to B and then a user
+ * tries to do a reverse-merge via the "unmerge" log link, then page
+ * A will still be a redirect (as it was after the original merge),
+ * though it will have the old revisions back from before (as expected).
+ * The user may have to "undo" the redirect manually to finish the "unmerge".
+ * Maybe this should delete redirects at the target page of merges?
+ *
+ * @return boolean Success
+ */
function merge() {
# Get the titles directly from the IDs, in case the target page params
# were spoofed. The queries are done based on the IDs, so it's best to
return false;
}
- # Update the revisions
+ # Get the timestamp pivot condition
if ( $this->mTimestamp ) {
$timewhere = "rev_timestamp <= {$this->mTimestamp}";
$timestampLimit = wfTimestamp( TS_MW, $this->mTimestamp );
$timewhere = "rev_timestamp <= {$maxtimestamp}";
$timestampLimit = wfTimestamp( TS_MW, $lasttimestamp );
}
+ # Check that there are not too many revisions to move
+ $limit = 5000; // avoid too much slave lag
+ $count = $dbw->select( 'revision', '1',
+ array( 'rev_page' => $this->mTargetID, $timewhere ),
+ __METHOD__,
+ array( 'LIMIT' => $limit + 1 )
+ )->numRows();
+ if ( $count > $limit ) {
+ $this->getOutput()->addWikiMsg( 'mergehistory-fail-toobig' );
+
+ return false;
+ }
# Do the moving...
$dbw->update(
'revision',
array( $destTitle->getPrefixedText(), $timestampLimit ), $this->getUser()
);
+ # @TODO: message should use redirect=no
$this->getOutput()->addWikiMsg( 'mergehistory-success',
$targetTitle->getPrefixedText(), $destTitle->getPrefixedText(), $count );
"mergehistory-empty": "No revisions can be merged.",
"mergehistory-success": "$3 {{PLURAL:$3|revision|revisions}} of [[:$1]] successfully merged into [[:$2]].",
"mergehistory-fail": "Unable to perform history merge, please recheck the page and time parameters.",
+ "mergehistory-fail-toobig" : "Unable to perform history merge as more than the limit of $1 {{PLURAL:$1|revision|revisions}} would be moved.",
"mergehistory-no-source": "Source page $1 does not exist.",
"mergehistory-no-destination": "Destination page $1 does not exist.",
"mergehistory-invalid-source": "Source page must be a valid title.",
"mergehistory-empty": "Used in [[Special:MergeHistory]].",
"mergehistory-success": "Used in [[Special:MergeHistory]].\n* $1 - target page title\n* $2 - destination page title\n* $3 - number of revisions which succeeded to merge",
"mergehistory-fail": "Used as error message in [[Special:MergeHistory]].",
+ "mergehistory-fail-toobig": "Used as error message in [[Special:MergeHistory]].\n* $1 - maximum allowed number of revisions that can be moved",
"mergehistory-no-source": "Used as error message in [[Special:MergeHistory]].\n* $1 - source page title\nSee also:\n* {{msg-mw|mergehistory-invalid-source}}\n* {{msg-mw|mergehistory-invalid-destination}}\n* {{msg-mw|mergehistory-no-destination}}\n* {{msg-mw|mergehistory-same-destination}}",
"mergehistory-no-destination": "Used as error message in [[Special:MergeHistory]].\n* $1 - destination page title\nSee also:\n* {{msg-mw|mergehistory-invalid-source}}\n* {{msg-mw|mergehistory-no-source}}\n* {{msg-mw|mergehistory-invalid-destination}}\n* {{msg-mw|mergehistory-same-destination}}",
"mergehistory-invalid-source": "Used as error message in [[Special:MergeHistory]].\n\nSee also:\n* {{msg-mw|mergehistory-no-source}}\n* {{msg-mw|mergehistory-invalid-destination}}\n* {{msg-mw|mergehistory-no-destination}}\n* {{msg-mw|mergehistory-same-destination}}",