}
public function execute( $par ) {
- $user = $this->getUser();
- if( !$this->userCanExecute( $user ) ) {
- $this->displayRestrictionError();
- return;
- }
-
- if ( wfReadOnly() ) {
- throw new ReadOnlyError;
- }
+ $this->checkPermissions();
+ $this->checkReadOnly();
$this->loadRequestParams();
}
private function showHistory() {
- $out = $this->getOutput();
- $out->setPageTitle( wfMsg( 'mergehistory' ) );
-
$this->showMergeForm();
# List all stored revisions
);
$haveRevisions = $revisions && $revisions->getNumRows() > 0;
+ $out = $this->getOutput();
$titleObj = $this->getTitle();
$action = $titleObj->getLocalURL( array( 'action' => 'submit' ) );
# Start the form here
$misc .= Html::hidden( 'destID', $this->mDestObj->getArticleID() );
$misc .= Html::hidden( 'target', $this->mTarget );
$misc .= Html::hidden( 'dest', $this->mDest );
- $misc .= Html::hidden( 'wpEditToken', $this->getUser()->editToken() );
+ $misc .= Html::hidden( 'wpEditToken', $this->getUser()->getEditToken() );
$misc .= Xml::closeElement( 'form' );
$out->addHTML( $misc );
}
# Last link
- if( !$rev->userCan( Revision::DELETED_TEXT ) ) {
+ if( !$rev->userCan( Revision::DELETED_TEXT, $this->getUser() ) ) {
$last = $this->message['last'];
} elseif( isset( $this->prevId[$row->rev_id] ) ) {
$last = Linker::linkKnown(
return "<li>$checkBox ($last) $pageLink . . $userLink $stxt $comment</li>";
}
- /**
- * Fetch revision text link if it's available to all users
- * @return string
- */
- function getPageLink( $row, $titleObj, $ts, $target ) {
- if( !$this->userCan( $row, Revision::DELETED_TEXT ) ) {
- return '<span class="history-deleted">' .
- $this->getLang()->timeanddate( $ts, true ) . '</span>';
- } else {
- $link = Linker::linkKnown(
- $titleObj,
- $this->getLang()->timeanddate( $ts, true ),
- array(),
- array(
- 'target' => $target,
- 'timestamp' => $ts
- )
- );
- if( $this->isDeleted( $row, Revision::DELETED_TEXT ) ) {
- $link = '<span class="history-deleted">' . $link . '</span>';
- }
- return $link;
- }
- }
-
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
# Give some pointers to make (last) links
$this->mForm->prevId = array();
foreach ( $this->mResult as $row ) {
- $batch->addObj( Title::makeTitleSafe( NS_USER, $row->rev_user_text ) );
- $batch->addObj( Title::makeTitleSafe( NS_USER_TALK, $row->rev_user_text ) );
+ $batch->addObj( Title::makeTitleSafe( NS_USER, $row->user_name ) );
+ $batch->addObj( Title::makeTitleSafe( NS_USER_TALK, $row->user_name ) );
$rev_id = isset( $rev_id ) ? $rev_id : $row->rev_id;
if( $rev_id > $row->rev_id ) {
function getQueryInfo() {
$conds = $this->mConds;
$conds['rev_page'] = $this->articleID;
- $conds[] = 'page_id = rev_page';
$conds[] = "rev_timestamp < {$this->maxTimestamp}";
return array(
- 'tables' => array( 'revision', 'page' ),
- 'fields' => array(
- 'rev_minor_edit', 'rev_timestamp', 'rev_user', 'rev_user_text',
- 'rev_comment', 'rev_id', 'rev_page', 'rev_parent_id',
- 'rev_text_id', 'rev_len', 'rev_deleted'
- ),
- 'conds' => $conds
+ 'tables' => array( 'revision', 'page', 'user' ),
+ 'fields' => array_merge( Revision::selectFields(), Revision::selectUserFields() ),
+ 'conds' => $conds,
+ 'join_conds' => array(
+ 'page' => Revision::pageJoinCond(),
+ 'user' => Revision::userJoinCond() )
);
}