86 public static function formatDiff( $row, $formattedComment =
null ) {
87 $titleObj = Title::makeTitle( $row->rc_namespace, $row->rc_title );
88 $timestamp =
wfTimestamp( TS_MW, $row->rc_timestamp );
90 if ( $row->rc_type ==
RC_LOG ) {
94 if ( $row->rc_deleted & RevisionRecord::DELETED_COMMENT ) {
95 $formattedComment =
wfMessage(
'rev-deleted-comment' )->escaped();
96 } elseif ( $formattedComment ===
null ) {
98 $formattedComment = $services->getCommentFormatter()->format(
99 $services->getCommentStore()->getComment(
'rc_comment', $row )->text );
102 $row->rc_last_oldid, $row->rc_this_oldid,
123 $comment, $actiontext =
''
126 ->format( $comment );
128 $formattedComment, $actiontext );
144 $title, $oldid, $newid, $timestamp, $formattedComment, $actiontext =
''
149 $unwrappedText = implode(
151 array_filter( [ $actiontext, $formattedComment ] )
153 $completeText = Html::rawElement(
'p', [], $unwrappedText ) .
"\n";
159 $anon = $services->getUserFactory()->newAnonymous();
160 $permManager = $services->getPermissionManager();
161 $accErrors = $permManager->getPermissionErrors(
169 if ( $title->getNamespace() < 0 || $accErrors || !$newid ) {
170 return $completeText;
173 $revLookup = $services->getRevisionLookup();
174 $contentHandlerFactory = $services->getContentHandlerFactory();
178 if ( $feedDiffCutoff > 0 ) {
179 $revRecord = $revLookup->getRevisionById( $oldid );
185 $context->setTitle( $title );
187 $model = $revRecord->getSlot(
191 $contentHandler = $contentHandlerFactory->getContentHandler( $model );
192 $de = $contentHandler->createDifferenceEngine( $context, $oldid, $newid );
193 $lang = $context->getLanguage();
194 $user = $context->getUser();
195 $diffText = $de->getDiff(
196 $context->msg(
'previousrevision' )->text(),
197 $context->msg(
'revisionasof',
198 $lang->userTimeAndDate( $timestamp, $user ),
199 $lang->userDate( $timestamp, $user ),
200 $lang->userTime( $timestamp, $user ) )->text() );
204 if ( $feedDiffCutoff <= 0 || ( strlen( $diffText ) > $feedDiffCutoff ) ) {
207 } elseif ( $diffText ===
false ) {
209 $diffText = Html::rawElement(
212 "Can't load revision $newid"
216 $diffText = UtfNormal\Validator::cleanUp( $diffText );
220 $revRecord = $revLookup->getRevisionById( $newid );
221 if ( $feedDiffCutoff <= 0 || $revRecord ===
null ) {
222 $newContent = $contentHandlerFactory
223 ->getContentHandler( $title->getContentModel() )
224 ->makeEmptyContent();
226 $newContent = $revRecord->getContent( SlotRecord::MAIN );
231 $text = $newContent->getText();
233 if ( $feedDiffCutoff <= 0 || strlen( $text ) > $feedDiffCutoff ) {
236 $html = nl2br( htmlspecialchars( $text ) );
246 if ( $html ===
null ) {
251 $diffText = Html::rawElement(
254 Html::rawElement(
'b', [],
wfMessage(
'newpage' )->text() )
256 $diffText .= Html::rawElement(
'div', [], $html );
259 $completeText .= $diffText;
261 return $completeText;