21 $pageTitle = $this->handle->getTitle();
22 if ( !$pageTitle->exists() ) {
26 $mwService = MediaWikiServices::getInstance();
27 $revisionFactory = $mwService->getRevisionFactory();
30 $dbr = $mwService->getDBLoadBalancer()->getConnectionRef( DB_REPLICA );
31 $options = [
'ORDER BY' =>
'rev_timestamp DESC, rev_id DESC' ];
32 $options[
'LIMIT' ] = self::COMMENT_COUNT;
33 $aid = $pageTitle->getArticleID();
34 $revQuery = $revisionFactory->getQueryInfo();
35 $result = $dbr->select(
36 $revQuery[
'tables' ],
37 $revQuery[
'fields' ],
38 [
'rev_page' => $aid ],
45 $commentFormatter = method_exists( $mwService,
'getCommentFormatter' )
46 ? $mwService->getCommentFormatter() :
null;
47 foreach ( $result as $row ) {
48 $revision = $revisionFactory->newRevisionFromRow( $row );
49 $comment = $revision->getComment();
57 if ( $commentFormatter ) {
58 $message = $commentFormatter->format( $comment->message->text() );
61 $message = Linker::formatComment( $comment->message->text() );
65 'humanTimestamp' => $this->context->getLanguage()
66 ->getHumanTimestamp(
new MWTimestamp( $revision->getTimestamp() ) ),
67 'timestamp' => $revision->getTimestamp(),
68 'summary' => $message,
69 'revisionId' => $revision->getId()
73 return $editSummaries;