* @return ResultWrapper
*/
function fetchRevisions( $limit, $offset, $direction ) {
+ // Fail if article doesn't exist.
+ if( !$this->getTitle()->exists() ) {
+ return new FakeResultWrapper( array() );
+ }
+
$dbr = wfGetDB( DB_SLAVE );
if ( $direction == HistoryPage::DIR_PREV ) {
$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' )
);
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 ),
'',
);
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(
$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
*
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 )