X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiFeedContributions.php;h=92d504e67bbfc01315a55663c16049159fdf5c53;hb=a9033efb28ca6e0e2e4ccb7bf9e9103b8d474b26;hp=cae1e150eee0441fdc63aeb0fd9799794225e58f;hpb=7f65646f35fca0544e6fc388f884bfedcb9a8948;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiFeedContributions.php b/includes/api/ApiFeedContributions.php index cae1e150ee..92d504e67b 100644 --- a/includes/api/ApiFeedContributions.php +++ b/includes/api/ApiFeedContributions.php @@ -1,9 +1,5 @@ revisionStore = MediaWikiServices::getInstance()->getRevisionStore(); + $params = $this->extractRequestParams(); $config = $this->getConfig(); @@ -134,7 +140,7 @@ class ApiFeedContributions extends ApiBase { if ( $title && $title->userCan( 'read', $this->getUser() ) ) { $date = $row->rev_timestamp; $comments = $title->getTalkPage()->getFullURL(); - $revision = Revision::newFromRow( $row ); + $revision = $this->revisionStore->newRevisionFromRow( $row ); return new FeedItem( $title->getPrefixedText(), @@ -150,21 +156,28 @@ class ApiFeedContributions extends ApiBase { } /** - * @param Revision $revision + * @since 1.32, takes a RevisionRecord instead of a Revision + * @param RevisionRecord $revision * @return string */ - protected function feedItemAuthor( $revision ) { - return $revision->getUserText(); + protected function feedItemAuthor( RevisionRecord $revision ) { + $user = $revision->getUser(); + return $user ? $user->getName() : ''; } /** - * @param Revision $revision + * @since 1.32, takes a RevisionRecord instead of a Revision + * @param RevisionRecord $revision * @return string */ - protected function feedItemDesc( $revision ) { + protected function feedItemDesc( RevisionRecord $revision ) { if ( $revision ) { $msg = wfMessage( 'colon-separator' )->inContentLanguage()->text(); - $content = $revision->getContent(); + try { + $content = $revision->getContent( 'main' ); + } catch ( RevisionAccessException $e ) { + $content = null; + } if ( $content instanceof TextContent ) { // only textual content has a "source view". @@ -177,8 +190,10 @@ class ApiFeedContributions extends ApiBase { $html = ''; } - return '

' . htmlspecialchars( $revision->getUserText() ) . $msg . - htmlspecialchars( FeedItem::stripComment( $revision->getComment() ) ) . + $comment = $revision->getComment(); + + return '

' . htmlspecialchars( $this->feedItemAuthor( $revision ) ) . $msg . + htmlspecialchars( FeedItem::stripComment( $comment ? $comment->text : '' ) ) . "

\n
\n
" . $html . '
'; }