Following r100264, update usages in core
[lhc/web/wiklou.git] / includes / specials / SpecialMergeHistory.php
index 0f046ab..b4b5f10 100644 (file)
@@ -81,15 +81,8 @@ class SpecialMergeHistory extends SpecialPage {
        }
 
        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();
 
@@ -167,9 +160,6 @@ class SpecialMergeHistory extends SpecialPage {
        }
 
        private function showHistory() {
-               $out = $this->getOutput();
-               $out->setPageTitle( wfMsg( 'mergehistory' ) );
-
                $this->showMergeForm();
 
                # List all stored revisions
@@ -178,6 +168,7 @@ class SpecialMergeHistory extends SpecialPage {
                );
                $haveRevisions = $revisions && $revisions->getNumRows() > 0;
 
+               $out = $this->getOutput();
                $titleObj = $this->getTitle();
                $action = $titleObj->getLocalURL( array( 'action' => 'submit' ) );
                # Start the form here
@@ -244,7 +235,7 @@ class SpecialMergeHistory extends SpecialPage {
                $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 );
 
@@ -271,7 +262,7 @@ class SpecialMergeHistory extends SpecialPage {
                }
 
                # 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(
@@ -296,31 +287,6 @@ class SpecialMergeHistory extends SpecialPage {
                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
@@ -477,8 +443,8 @@ class MergeHistoryPager extends ReverseChronologicalPager {
                # 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 ) {
@@ -504,16 +470,14 @@ class MergeHistoryPager extends ReverseChronologicalPager {
        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() )
                );
        }