merging latest master
[lhc/web/wiklou.git] / includes / actions / HistoryAction.php
index 50d210f..1c57f25 100644 (file)
@@ -248,8 +248,8 @@ class HistoryAction extends FormlessAction {
 
                $feed = new $wgFeedClasses[$type](
                        $this->getTitle()->getPrefixedText() . ' - ' .
-                       wfMsgForContent( 'history-feed-title' ),
-                       wfMsgForContent( 'history-feed-description' ),
+                       $this->msg( 'history-feed-title' )->inContentLanguage()->text(),
+                       $this->msg( 'history-feed-description' )->inContentLanguage()->text(),
                        $this->getTitle()->getFullUrl( 'action=history' )
                );
 
@@ -275,8 +275,8 @@ class HistoryAction extends FormlessAction {
 
        function feedEmpty() {
                return new FeedItem(
-                       wfMsgForContent( 'nohistory' ),
-                       $this->getOutput()->parse( wfMsgForContent( 'history-feed-empty' ) ),
+                       $this->msg( 'nohistory' )->inContentLanguage()->text(),
+                       $this->msg( 'history-feed-empty' )->inContentLanguage()->parseAsBlock(),
                        $this->getTitle()->getFullUrl(),
                        wfTimestamp( TS_MW ),
                        '',
@@ -304,15 +304,14 @@ class HistoryAction extends FormlessAction {
                );
                if ( $rev->getComment() == '' ) {
                        global $wgContLang;
-                       $title = wfMsgForContent( 'history-feed-item-nocomment',
+                       $title = $this->msg( 'history-feed-item-nocomment',
                                $rev->getUserText(),
                                $wgContLang->timeanddate( $rev->getTimestamp() ),
                                $wgContLang->date( $rev->getTimestamp() ),
-                               $wgContLang->time( $rev->getTimestamp() )
-                       );
+                               $wgContLang->time( $rev->getTimestamp() ) )->inContentLanguage()->text();
                } else {
                        $title = $rev->getUserText() .
-                       wfMsgForContent( 'colon-separator' ) .
+                       $this->msg( 'colon-separator' )->inContentLanguage()->text() .
                        FeedItem::stripComment( $rev->getComment() );
                }
                return new FeedItem(
@@ -418,34 +417,11 @@ class HistoryPager extends ReverseChronologicalPager {
                                $batch->add( NS_USER_TALK, $row->rev_user_text );
                        }
                }
-               $this->parentLens = $this->getParentLengths( $revIds );
+               $this->parentLens = Revision::getParentLengths( $this->mDb, $revIds );
                $batch->execute();
                $this->mResult->seek( 0 );
        }
 
-       /**
-        * Do a batched query to get the parent revision lengths
-        * @param $revIds array
-        * @return array
-        * @TODO: stolen from Contributions, refactor
-        */
-       private function getParentLengths( array $revIds ) {
-               $revLens = array();
-               if ( !$revIds ) {
-                       return $revLens; // empty
-               }
-               wfProfileIn( __METHOD__ );
-               $res = $this->mDb->select( 'revision',
-                       array( 'rev_id', 'rev_len' ),
-                       array( 'rev_id' => $revIds ),
-                       __METHOD__ );
-               foreach ( $res as $row ) {
-                       $revLens[$row->rev_id] = $row->rev_len;
-               }
-               wfProfileOut( __METHOD__ );
-               return $revLens;
-       }
-
        /**
         * Creates begin of history list with a submit button
         *
@@ -635,18 +611,17 @@ class HistoryPager extends ReverseChronologicalPager {
 
                if ( $notificationtimestamp && ( $row->rev_timestamp >= $notificationtimestamp ) ) {
                        $s2 .= ' <span class="updatedmarker">' .  $this->msg( 'updatedmarker' )->escaped() . '</span>';
+                       $classes[] = 'mw-history-line-updated';
                }
 
                $tools = array();
 
                # Rollback and undo links
-               if ( $prevRev &&
-                       !count( $this->getTitle()->getUserPermissionsErrors( 'edit', $this->getUser() ) ) )
-               {
-                       if ( $latest && !count( $this->getTitle()->getUserPermissionsErrors( 'rollback', $this->getUser() ) ) ) {
+               if ( $prevRev && $this->getTitle()->quickUserCan( 'edit', $user ) ) {
+                       if ( $latest && $this->getTitle()->quickUserCan( 'rollback', $user ) ) {
                                $this->preventClickjacking();
                                $tools[] = '<span class="mw-rollback-link">' .
-                                       Linker::buildRollbackLink( $rev ) . '</span>';
+                                       Linker::buildRollbackLink( $rev, $this->getContext() ) . '</span>';
                        }
 
                        if ( !$rev->isDeleted( Revision::DELETED_TEXT )