X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Factions%2FHistoryAction.php;h=6a6104570c54446fac9ad9f99069ffaf6cee502b;hb=ce81d0017408ea506d057eeb4289c3c793f0a12f;hp=385ccc9607322e324dc22a3d76092341034e2d96;hpb=d00185cb182993bc065188f5f3d149f82c84e7eb;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/actions/HistoryAction.php b/includes/actions/HistoryAction.php index 385ccc9607..6a6104570c 100644 --- a/includes/actions/HistoryAction.php +++ b/includes/actions/HistoryAction.php @@ -95,6 +95,7 @@ class HistoryAction extends FormlessAction { private function preCacheMessages() { // Precache various messages if ( !isset( $this->message ) ) { + $this->message = []; $msgs = [ 'cur', 'last', 'pipe-separator' ]; foreach ( $msgs as $msg ) { $this->message[$msg] = $this->msg( $msg )->escaped(); @@ -432,27 +433,30 @@ class HistoryAction extends FormlessAction { * @return FeedItem */ function feedItem( $row ) { - $rev = new Revision( $row, 0, $this->getTitle() ); - + $revisionStore = MediaWikiServices::getInstance()->getRevisionStore(); + $rev = $revisionStore->newRevisionFromRow( $row, 0, $this->getTitle() ); + $prevRev = $revisionStore->getPreviousRevision( $rev ); + $revComment = $rev->getComment() === null ? null : $rev->getComment()->text; $text = FeedUtils::formatDiffRow( $this->getTitle(), - $this->getTitle()->getPreviousRevisionID( $rev->getId() ), + $prevRev ? $prevRev->getId() : false, $rev->getId(), $rev->getTimestamp(), - $rev->getComment() + $revComment ); - if ( $rev->getComment() == '' ) { + $revUserText = $rev->getUser() ? $rev->getUser()->getName() : ''; + if ( $revComment == '' ) { $contLang = MediaWikiServices::getInstance()->getContentLanguage(); $title = $this->msg( 'history-feed-item-nocomment', - $rev->getUserText(), + $revUserText, $contLang->timeanddate( $rev->getTimestamp() ), $contLang->date( $rev->getTimestamp() ), $contLang->time( $rev->getTimestamp() ) )->inContentLanguage()->text(); } else { - $title = $rev->getUserText() . + $title = $revUserText . $this->msg( 'colon-separator' )->inContentLanguage()->text() . - FeedItem::stripComment( $rev->getComment() ); + FeedItem::stripComment( $revComment ); } return new FeedItem( @@ -460,7 +464,7 @@ class HistoryAction extends FormlessAction { $text, $this->getTitle()->getFullURL( 'diff=' . $rev->getId() . '&oldid=prev' ), $rev->getTimestamp(), - $rev->getUserText(), + $revUserText, $this->getTitle()->getTalkPage()->getFullURL() ); }