87 public static function formatDiff( $row, $formattedComment =
null ) {
88 $titleObj = Title::makeTitle( $row->rc_namespace, $row->rc_title );
89 $timestamp =
wfTimestamp( TS_MW, $row->rc_timestamp );
91 if ( $row->rc_type ==
RC_LOG ) {
95 if ( $row->rc_deleted & RevisionRecord::DELETED_COMMENT ) {
96 $formattedComment =
wfMessage(
'rev-deleted-comment' )->escaped();
97 } elseif ( $formattedComment ===
null ) {
99 $formattedComment = $services->getCommentFormatter()->format(
100 $services->getCommentStore()->getComment(
'rc_comment', $row )->text );
103 $row->rc_last_oldid, $row->rc_this_oldid,
124 $comment, $actiontext =
''
127 ->format( $comment );
129 $formattedComment, $actiontext );
145 $title, $oldid, $newid, $timestamp, $formattedComment, $actiontext =
''
150 $unwrappedText = implode(
152 array_filter( [ $actiontext, $formattedComment ] )
154 $completeText = Html::rawElement(
'p', [], $unwrappedText ) .
"\n";
161 $permManager = $services->getPermissionManager();
162 $accErrors = $permManager->getPermissionErrors(
170 if ( $title->getNamespace() < 0 || $accErrors || !$newid ) {
171 return $completeText;
174 $revLookup = $services->getRevisionLookup();
175 $contentHandlerFactory = $services->getContentHandlerFactory();
179 if ( $feedDiffCutoff > 0 ) {
180 $revRecord = $revLookup->getRevisionById( $oldid );
186 $context->setTitle( $title );
188 $model = $revRecord->getSlot(
192 $contentHandler = $contentHandlerFactory->getContentHandler( $model );
193 $de = $contentHandler->createDifferenceEngine( $context, $oldid, $newid );
194 $lang = $context->getLanguage();
195 $user = $context->getUser();
196 $diffText = $de->getDiff(
197 $context->msg(
'previousrevision' )->text(),
198 $context->msg(
'revisionasof',
199 $lang->userTimeAndDate( $timestamp, $user ),
200 $lang->userDate( $timestamp, $user ),
201 $lang->userTime( $timestamp, $user ) )->text() );
205 if ( $feedDiffCutoff <= 0 || ( strlen( $diffText ) > $feedDiffCutoff ) ) {
208 } elseif ( $diffText ===
false ) {
210 $diffText = Html::rawElement(
213 "Can't load revision $newid"
217 $diffText = UtfNormal\Validator::cleanUp( $diffText );
221 $revRecord = $revLookup->getRevisionById( $newid );
222 if ( $feedDiffCutoff <= 0 || $revRecord ===
null ) {
223 $newContent = $contentHandlerFactory
224 ->getContentHandler( $title->getContentModel() )
225 ->makeEmptyContent();
227 $newContent = $revRecord->getContent( SlotRecord::MAIN );
232 $text = $newContent->getText();
234 if ( $feedDiffCutoff <= 0 || strlen( $text ) > $feedDiffCutoff ) {
237 $html = nl2br( htmlspecialchars( $text ) );
247 if ( $html ===
null ) {
252 $diffText = Html::rawElement(
255 Html::rawElement(
'b', [],
wfMessage(
'newpage' )->text() )
257 $diffText .= Html::rawElement(
'div', [], $html );
260 $completeText .= $diffText;
262 return $completeText;