3 * Generates a list of changes using an Enhanced system (uses javascript).
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
23 class EnhancedChangesList
extends ChangesList
{
26 * @var RCCacheEntryFactory
28 protected $cacheEntryFactory;
31 * @var array Array of array of RCCacheEntry
38 protected $templateParser;
41 * @param IContextSource|Skin $obj
42 * @param array $filterGroups Array of ChangesListFilterGroup objects (currently optional)
45 public function __construct( $obj, array $filterGroups = [] ) {
46 if ( $obj instanceof Skin
) {
47 // @todo: deprecate constructing with Skin
48 $context = $obj->getContext();
50 if ( !$obj instanceof IContextSource
) {
51 throw new MWException( 'EnhancedChangesList must be constructed with a '
52 . 'context source or skin.' );
58 parent
::__construct( $context, $filterGroups );
60 // message is set by the parent ChangesList class
61 $this->cacheEntryFactory
= new RCCacheEntryFactory(
66 $this->templateParser
= new TemplateParser();
70 * Add the JavaScript file for enhanced changeslist
73 public function beginRecentChangesList() {
75 $this->rcMoveIndex
= 0;
76 $this->rcCacheIndex
= 0;
78 $this->rclistOpen
= false;
79 $this->getOutput()->addModuleStyles( [
81 'mediawiki.interface.helpers.styles',
82 'mediawiki.special.changeslist',
83 'mediawiki.special.changeslist.enhanced',
85 $this->getOutput()->addModules( [
86 'jquery.makeCollapsible',
89 return '<div class="mw-changeslist">';
93 * Format a line for enhanced recentchange (aka with javascript and block of lines).
95 * @param RecentChange &$rc
96 * @param bool $watched
97 * @param int|null $linenumber (default null)
101 public function recentChangesLine( &$rc, $watched = false, $linenumber = null ) {
102 $date = $this->getLanguage()->userDate(
103 $rc->mAttribs
['rc_timestamp'],
106 if ( $this->lastdate
=== '' ) {
107 $this->lastdate
= $date;
112 # If it's a new day, flush the cache and update $this->lastdate
113 if ( $date !== $this->lastdate
) {
114 # Process current cache (uses $this->lastdate to generate a heading)
115 $ret = $this->recentChangesBlock();
116 $this->rc_cache
= [];
117 $this->lastdate
= $date;
120 $cacheEntry = $this->cacheEntryFactory
->newFromRecentChange( $rc, $watched );
121 $this->addCacheEntry( $cacheEntry );
127 * Put accumulated information into the cache, for later display.
128 * Page moves go on their own line.
130 * @param RCCacheEntry $cacheEntry
132 protected function addCacheEntry( RCCacheEntry
$cacheEntry ) {
133 $cacheGroupingKey = $this->makeCacheGroupingKey( $cacheEntry );
135 if ( !isset( $this->rc_cache
[$cacheGroupingKey] ) ) {
136 $this->rc_cache
[$cacheGroupingKey] = [];
139 array_push( $this->rc_cache
[$cacheGroupingKey], $cacheEntry );
143 * @todo use rc_source to group, if set; fallback to rc_type
145 * @param RCCacheEntry $cacheEntry
149 protected function makeCacheGroupingKey( RCCacheEntry
$cacheEntry ) {
150 $title = $cacheEntry->getTitle();
151 $cacheGroupingKey = $title->getPrefixedDBkey();
153 $type = $cacheEntry->mAttribs
['rc_type'];
155 if ( $type == RC_LOG
) {
157 $cacheGroupingKey = SpecialPage
::getTitleFor(
159 $cacheEntry->mAttribs
['rc_log_type']
160 )->getPrefixedDBkey();
163 return $cacheGroupingKey;
168 * @param RCCacheEntry[] $block
170 * @throws DomainException
172 protected function recentChangesBlockGroup( $block ) {
173 $recentChangesFlags = $this->getConfig()->get( 'RecentChangesFlags' );
175 # Add the namespace and title of the block as part of the class
176 $tableClasses = [ 'mw-collapsible', 'mw-collapsed', 'mw-enhanced-rc', 'mw-changeslist-line' ];
177 if ( $block[0]->mAttribs
['rc_log_type'] ) {
179 $tableClasses[] = 'mw-changeslist-log';
180 $tableClasses[] = Sanitizer
::escapeClass( 'mw-changeslist-log-'
181 . $block[0]->mAttribs
['rc_log_type'] );
183 $tableClasses[] = 'mw-changeslist-edit';
184 $tableClasses[] = Sanitizer
::escapeClass( 'mw-changeslist-ns'
185 . $block[0]->mAttribs
['rc_namespace'] . '-' . $block[0]->mAttribs
['rc_title'] );
187 if ( $block[0]->watched
) {
188 $tableClasses[] = 'mw-changeslist-line-watched';
190 $tableClasses[] = 'mw-changeslist-line-not-watched';
193 # Collate list of users
197 # Some catalyst variables...
200 $RCShowChangedSize = $this->getConfig()->get( 'RCShowChangedSize' );
202 # Default values for RC flags
203 $collectedRcFlags = [];
204 foreach ( $recentChangesFlags as $key => $value ) {
205 $flagGrouping = ( $recentChangesFlags[$key]['grouping'] ??
'any' );
206 switch ( $flagGrouping ) {
208 $collectedRcFlags[$key] = true;
211 $collectedRcFlags[$key] = false;
214 throw new DomainException( "Unknown grouping type \"{$flagGrouping}\"" );
217 foreach ( $block as $rcObj ) {
218 // If all log actions to this page were hidden, then don't
219 // give the name of the affected page for this block!
220 if ( !static::isDeleted( $rcObj, LogPage
::DELETED_ACTION
) ) {
223 $u = $rcObj->userlink
;
224 if ( !isset( $userlinks[$u] ) ) {
227 if ( $rcObj->mAttribs
['rc_type'] != RC_LOG
) {
230 # Get the latest entry with a page_id and oldid
231 # since logs may not have these.
232 if ( !$curId && $rcObj->mAttribs
['rc_cur_id'] ) {
233 $curId = $rcObj->mAttribs
['rc_cur_id'];
239 # Sort the list and convert to text
240 krsort( $userlinks );
243 foreach ( $userlinks as $userlink => $count ) {
245 $text .= $this->getLanguage()->getDirMark();
247 $formattedCount = $this->msg( 'ntimes' )->numParams( $count )->escaped();
248 $text .= ' ' . $this->msg( 'parentheses' )->rawParams( $formattedCount )->escaped();
250 array_push( $users, $text );
255 $revDeletedMsg = false;
257 $revDeletedMsg = $this->msg( 'rev-deleted-event' )->escaped();
258 } elseif ( $allLogs ) {
259 $articleLink = $this->maybeWatchedLink( $block[0]->link
, $block[0]->watched
);
261 $articleLink = $this->getArticleLink(
262 $block[0], $block[0]->unpatrolled
, $block[0]->watched
);
265 $queryParams['curid'] = $curId;
270 foreach ( $block as $i => $rcObj ) {
271 $line = $this->getLineData( $block, $rcObj, $queryParams );
273 // completely ignore this RC entry if we don't want to render it
279 foreach ( $line['recentChangesFlagsRaw'] as $key => $value ) {
280 $flagGrouping = ( $recentChangesFlags[$key]['grouping'] ??
'any' );
281 switch ( $flagGrouping ) {
284 $collectedRcFlags[$key] = false;
289 $collectedRcFlags[$key] = true;
293 throw new DomainException( "Unknown grouping type \"{$flagGrouping}\"" );
297 // Roll up filter-based CSS classes
298 $filterClasses = array_merge( $filterClasses, $this->getHTMLClassesForFilters( $rcObj ) );
299 // Add classes for change tags separately, getHTMLClassesForFilters() doesn't add them
300 $this->getTags( $rcObj, $filterClasses );
301 $filterClasses = array_unique( $filterClasses );
306 // Further down are some assumptions that $block is a 0-indexed array
307 // with (count-1) as last key. Let's make sure it is.
308 $block = array_values( $block );
309 $filterClasses = array_values( $filterClasses );
311 if ( empty( $block ) ||
!$lines ) {
312 // if we can't show anything, don't display this block altogether
316 $logText = $this->getLogText( $block, $queryParams, $allLogs,
317 $collectedRcFlags['newpage'], $namehidden
320 # Character difference (does not apply if only log items)
321 $charDifference = false;
322 if ( $RCShowChangedSize && !$allLogs ) {
324 $first = count( $block ) - 1;
325 # Some events (like logs and category changes) have an "empty" size, so we need to skip those...
326 while ( $last < $first && $block[$last]->mAttribs
['rc_new_len'] === null ) {
329 while ( $last < $first && $block[$first]->mAttribs
['rc_old_len'] === null ) {
333 $charDifference = $this->formatCharacterDifference( $block[$first], $block[$last] ) ?
: false;
336 $numberofWatchingusers = $this->numberofWatchingusers( $block[0]->numberofWatchingusers
);
337 $usersList = $this->msg( 'brackets' )->rawParams(
338 implode( $this->message
['semicolon-separator'], $users )
342 if ( is_callable( $this->changeLinePrefixer
) ) {
343 $prefix = call_user_func( $this->changeLinePrefixer
, $block[0], $this, true );
347 'articleLink' => $articleLink,
348 'charDifference' => $charDifference,
349 'collectedRcFlags' => $this->recentChangesFlags( $collectedRcFlags ),
350 'filterClasses' => $filterClasses,
351 'languageDirMark' => $this->getLanguage()->getDirMark(),
353 'logText' => $logText,
354 'numberofWatchingusers' => $numberofWatchingusers,
356 'rev-deleted-event' => $revDeletedMsg,
357 'tableClasses' => $tableClasses,
358 'timestamp' => $block[0]->timestamp
,
359 'fullTimestamp' => $block[0]->getAttribute( 'rc_timestamp' ),
360 'users' => $usersList,
363 $this->rcCacheIndex++
;
365 return $this->templateParser
->processTemplate(
366 'EnhancedChangesListGroup',
372 * @param RCCacheEntry[] $block
373 * @param RCCacheEntry $rcObj
374 * @param array $queryParams
378 * @throws MWException
380 protected function getLineData( array $block, RCCacheEntry
$rcObj, array $queryParams = [] ) {
381 $RCShowChangedSize = $this->getConfig()->get( 'RCShowChangedSize' );
383 $type = $rcObj->mAttribs
['rc_type'];
385 $lineParams = [ 'targetTitle' => $rcObj->getTitle() ];
387 $classes = [ 'mw-enhanced-rc' ];
388 if ( $rcObj->watched
) {
389 $classes[] = 'mw-enhanced-watched';
391 $classes = array_merge( $classes, $this->getHTMLClasses( $rcObj, $rcObj->watched
) );
393 $separator = ' <span class="mw-changeslist-separator"></span> ';
395 $data['recentChangesFlags'] = [
396 'newpage' => $type == RC_NEW
,
397 'minor' => $rcObj->mAttribs
['rc_minor'],
398 'unpatrolled' => $rcObj->unpatrolled
,
399 'bot' => $rcObj->mAttribs
['rc_bot'],
402 $params = $queryParams;
404 if ( $rcObj->mAttribs
['rc_this_oldid'] != 0 ) {
405 $params['oldid'] = $rcObj->mAttribs
['rc_this_oldid'];
409 if ( $type == RC_LOG
) {
410 $link = htmlspecialchars( $rcObj->timestamp
);
412 } elseif ( !ChangesList
::userCan( $rcObj, Revision
::DELETED_TEXT
, $this->getUser() ) ) {
413 $link = Html
::element( 'span', [ 'class' => 'history-deleted' ], $rcObj->timestamp
);
415 $link = $this->linkRenderer
->makeKnownLink(
421 if ( static::isDeleted( $rcObj, Revision
::DELETED_TEXT
) ) {
422 $link = '<span class="history-deleted">' . $link . '</span> ';
425 $data['timestampLink'] = $link;
427 $currentAndLastLinks = '';
428 if ( !$type == RC_LOG ||
$type == RC_NEW
) {
429 $currentAndLastLinks .= ' ' . $this->msg( 'parentheses' )->rawParams(
431 $this->message
['pipe-separator'] .
435 $data['currentAndLastLinks'] = $currentAndLastLinks;
436 $data['separatorAfterCurrentAndLastLinks'] = $separator;
439 if ( $RCShowChangedSize ) {
440 $cd = $this->formatCharacterDifference( $rcObj );
442 $data['characterDiff'] = $cd;
443 $data['separatorAfterCharacterDiff'] = $separator;
447 if ( $rcObj->mAttribs
['rc_type'] == RC_LOG
) {
448 $data['logEntry'] = $this->insertLogEntry( $rcObj );
449 } elseif ( $this->isCategorizationWithoutRevision( $rcObj ) ) {
450 $data['comment'] = $this->insertComment( $rcObj );
453 $data['userLink'] = $rcObj->userlink
;
454 $data['userTalkLink'] = $rcObj->usertalklink
;
455 $data['comment'] = $this->insertComment( $rcObj );
459 $data['rollback'] = $this->getRollback( $rcObj );
462 $data['tags'] = $this->getTags( $rcObj, $classes );
464 $attribs = $this->getDataAttributes( $rcObj );
466 // give the hook a chance to modify the data
467 $success = Hooks
::run( 'EnhancedChangesListModifyLineData',
468 [ $this, &$data, $block, $rcObj, &$classes, &$attribs ] );
470 // skip entry if hook aborted it
473 $attribs = array_filter( $attribs,
474 [ Sanitizer
::class, 'isReservedDataAttribute' ],
478 $lineParams['recentChangesFlagsRaw'] = [];
479 if ( isset( $data['recentChangesFlags'] ) ) {
480 $lineParams['recentChangesFlags'] = $this->recentChangesFlags( $data['recentChangesFlags'] );
481 # FIXME: This is used by logic, don't return it in the template params.
482 $lineParams['recentChangesFlagsRaw'] = $data['recentChangesFlags'];
483 unset( $data['recentChangesFlags'] );
486 if ( isset( $data['timestampLink'] ) ) {
487 $lineParams['timestampLink'] = $data['timestampLink'];
488 unset( $data['timestampLink'] );
491 $lineParams['classes'] = array_values( $classes );
492 $lineParams['attribs'] = Html
::expandAttributes( $attribs );
494 // everything else: makes it easier for extensions to add or remove data
495 $lineParams['data'] = array_values( $data );
501 * Generates amount of changes (linking to diff ) & link to history.
503 * @param RCCacheEntry[] $block
504 * @param array $queryParams
505 * @param bool $allLogs
507 * @param bool $namehidden
510 protected function getLogText( $block, $queryParams, $allLogs, $isnew, $namehidden ) {
511 if ( empty( $block ) ) {
516 static $nchanges = [];
517 static $sinceLastVisitMsg = [];
519 $n = count( $block );
520 if ( !isset( $nchanges[$n] ) ) {
521 $nchanges[$n] = $this->msg( 'nchanges' )->numParams( $n )->escaped();
525 $unvisitedOldid = null;
526 /** @var RCCacheEntry $rcObj */
527 foreach ( $block as $rcObj ) {
528 // Same logic as below inside main foreach
529 if ( $rcObj->watched
) {
531 $unvisitedOldid = $rcObj->mAttribs
['rc_last_oldid'];
534 if ( !isset( $sinceLastVisitMsg[$sinceLast] ) ) {
535 $sinceLastVisitMsg[$sinceLast] =
536 $this->msg( 'enhancedrc-since-last-visit' )->numParams( $sinceLast )->escaped();
539 $currentRevision = 0;
540 foreach ( $block as $rcObj ) {
541 if ( !$currentRevision ) {
542 $currentRevision = $rcObj->mAttribs
['rc_this_oldid'];
548 /** @var RecentChange $block0 */
550 $last = $block[count( $block ) - 1];
554 $rcObj->mAttribs
['rc_type'] == RC_CATEGORIZE ||
555 !ChangesList
::userCan( $rcObj, Revision
::DELETED_TEXT
, $this->getUser() )
557 $links['total-changes'] = Html
::rawElement( 'span', [], $nchanges[$n] );
559 $links['total-changes'] = Html
::rawElement( 'span', [],
560 $this->linkRenderer
->makeKnownLink(
562 new HtmlArmor( $nchanges[$n] ),
563 [ 'class' => 'mw-changeslist-groupdiff' ],
565 'diff' => $currentRevision,
566 'oldid' => $last->mAttribs
['rc_last_oldid'],
573 $rcObj->mAttribs
['rc_type'] != RC_CATEGORIZE
&&
577 $links['total-changes-since-last'] = Html
::rawElement( 'span', [],
578 $this->linkRenderer
->makeKnownLink(
580 new HtmlArmor( $sinceLastVisitMsg[$sinceLast] ),
581 [ 'class' => 'mw-changeslist-groupdiff' ],
583 'diff' => $currentRevision,
584 'oldid' => $unvisitedOldid,
592 if ( $allLogs ||
$rcObj->mAttribs
['rc_type'] == RC_CATEGORIZE
) {
593 // don't show history link for logs
594 } elseif ( $namehidden ||
!$block0->getTitle()->exists() ) {
595 $links['history'] = Html
::rawElement( 'span', [], $this->message
['enhancedrc-history'] );
597 $params = $queryParams;
598 $params['action'] = 'history';
600 $links['history'] = Html
::rawElement( 'span', [],
601 $this->linkRenderer
->makeKnownLink(
603 new HtmlArmor( $this->message
['enhancedrc-history'] ),
604 [ 'class' => 'mw-changeslist-history' ],
610 # Allow others to alter, remove or add to these links
611 Hooks
::run( 'EnhancedChangesList::getLogText',
612 [ $this, &$links, $block ] );
618 $logtext = Html
::rawElement( 'span', [ 'class' => 'mw-changeslist-links' ],
619 implode( ' ', $links ) );
620 return ' ' . $logtext;
624 * Enhanced RC ungrouped line.
626 * @param RecentChange|RCCacheEntry $rcObj
627 * @return string A HTML formatted line (generated using $r)
629 protected function recentChangesBlockLine( $rcObj ) {
632 $query['curid'] = $rcObj->mAttribs
['rc_cur_id'];
634 $type = $rcObj->mAttribs
['rc_type'];
635 $logType = $rcObj->mAttribs
['rc_log_type'];
636 $classes = $this->getHTMLClasses( $rcObj, $rcObj->watched
);
637 $classes[] = 'mw-enhanced-rc';
641 $classes[] = 'mw-changeslist-log';
642 $classes[] = Sanitizer
::escapeClass( 'mw-changeslist-log-' . $logType );
644 $classes[] = 'mw-changeslist-edit';
645 $classes[] = Sanitizer
::escapeClass( 'mw-changeslist-ns' .
646 $rcObj->mAttribs
['rc_namespace'] . '-' . $rcObj->mAttribs
['rc_title'] );
650 $data['recentChangesFlags'] = [
651 'newpage' => $type == RC_NEW
,
652 'minor' => $rcObj->mAttribs
['rc_minor'],
653 'unpatrolled' => $rcObj->unpatrolled
,
654 'bot' => $rcObj->mAttribs
['rc_bot'],
656 // timestamp is not really a link here, but is called timestampLink
657 // for consistency with EnhancedChangesListModifyLineData
658 $data['timestampLink'] = htmlspecialchars( $rcObj->timestamp
);
660 # Article or log link
662 $logPage = new LogPage( $logType );
663 $logTitle = SpecialPage
::getTitleFor( 'Log', $logType );
664 $logName = $logPage->getName()->text();
665 $data['logLink'] = Html
::rawElement( 'span', [ 'class' => 'mw-changeslist-links' ],
666 $this->linkRenderer
->makeKnownLink( $logTitle, $logName )
669 $data['articleLink'] = $this->getArticleLink( $rcObj, $rcObj->unpatrolled
, $rcObj->watched
);
672 # Diff and hist links
673 if ( $type != RC_LOG
&& $type != RC_CATEGORIZE
) {
674 $query['action'] = 'history';
675 $data['historyLink'] = $this->getDiffHistLinks( $rcObj, $query, false );
677 $data['separatorAfterLinks'] = ' <span class="mw-changeslist-separator"></span> ';
680 if ( $this->getConfig()->get( 'RCShowChangedSize' ) ) {
681 $cd = $this->formatCharacterDifference( $rcObj );
683 $data['characterDiff'] = $cd;
684 $data['separatorAftercharacterDiff'] = ' <span class="mw-changeslist-separator"></span> ';
688 if ( $type == RC_LOG
) {
689 $data['logEntry'] = $this->insertLogEntry( $rcObj );
690 } elseif ( $this->isCategorizationWithoutRevision( $rcObj ) ) {
691 $data['comment'] = $this->insertComment( $rcObj );
693 $data['userLink'] = $rcObj->userlink
;
694 $data['userTalkLink'] = $rcObj->usertalklink
;
695 $data['comment'] = $this->insertComment( $rcObj );
696 if ( $type == RC_CATEGORIZE
) {
697 $data['historyLink'] = $this->getDiffHistLinks( $rcObj, $query, false );
699 $data['rollback'] = $this->getRollback( $rcObj );
703 $data['tags'] = $this->getTags( $rcObj, $classes );
705 # Show how many people are watching this if enabled
706 $data['watchingUsers'] = $this->numberofWatchingusers( $rcObj->numberofWatchingusers
);
708 $data['attribs'] = array_merge( $this->getDataAttributes( $rcObj ), [ 'class' => $classes ] );
710 // give the hook a chance to modify the data
711 $success = Hooks
::run( 'EnhancedChangesListModifyBlockLineData',
712 [ $this, &$data, $rcObj ] );
714 // skip entry if hook aborted it
717 $attribs = $data['attribs'];
718 unset( $data['attribs'] );
719 $attribs = array_filter( $attribs, function ( $key ) {
720 return $key === 'class' || Sanitizer
::isReservedDataAttribute( $key );
721 }, ARRAY_FILTER_USE_KEY
);
724 if ( is_callable( $this->changeLinePrefixer
) ) {
725 $prefix = call_user_func( $this->changeLinePrefixer
, $rcObj, $this, false );
728 $line = Html
::openElement( 'table', $attribs ) . Html
::openElement( 'tr' );
730 $line .= Html
::rawElement( 'td', [],
731 $this->getHighlightsContainerDiv()
734 $line .= Html
::rawElement( 'td', [], '<span class="mw-enhancedchanges-arrow-space"></span>' );
735 $line .= Html
::rawElement( 'td', [ 'class' => 'mw-changeslist-line-prefix' ], $prefix );
736 $line .= '<td class="mw-enhanced-rc" colspan="2">';
738 if ( isset( $data['recentChangesFlags'] ) ) {
739 $line .= $this->recentChangesFlags( $data['recentChangesFlags'] );
740 unset( $data['recentChangesFlags'] );
743 if ( isset( $data['timestampLink'] ) ) {
744 $line .= "\u{00A0}" . $data['timestampLink'];
745 unset( $data['timestampLink'] );
747 $line .= "\u{00A0}</td>";
748 $line .= Html
::openElement( 'td', [
749 'class' => 'mw-changeslist-line-inner',
750 // Used for reliable determination of the affiliated page
751 'data-target-page' => $rcObj->getTitle(),
754 // everything else: makes it easier for extensions to add or remove data
755 foreach ( $data as $key => $dataItem ) {
756 $line .= Html
::rawElement( 'span', [
757 'class' => 'mw-changeslist-line-inner-' . $key,
761 $line .= "</td></tr></table>\n";
767 * Returns value to be used in 'historyLink' element of $data param in
768 * EnhancedChangesListModifyBlockLineData hook.
772 * @param RCCacheEntry $rc
773 * @param array $query array of key/value pairs to append as a query string
774 * @param bool $useParentheses (optional) Wrap comments in parentheses where needed
775 * @return string HTML
777 public function getDiffHistLinks( RCCacheEntry
$rc, array $query, $useParentheses = true ) {
778 $pageTitle = $rc->getTitle();
779 if ( $rc->getAttribute( 'rc_type' ) == RC_CATEGORIZE
) {
780 // For categorizations we must swap the category title with the page title!
781 $pageTitle = Title
::newFromID( $rc->getAttribute( 'rc_cur_id' ) );
783 // The page has been deleted, but the RC entry
784 // deletion job has not run yet. Just skip.
789 $histLink = $this->linkRenderer
->makeKnownLink(
791 new HtmlArmor( $this->message
['hist'] ),
792 [ 'class' => 'mw-changeslist-history' ],
795 if ( $useParentheses ) {
796 $retVal = $this->msg( 'parentheses' )
797 ->rawParams( $rc->difflink
. $this->message
['pipe-separator']
798 . $histLink )->escaped();
800 $retVal = Html
::rawElement( 'span', [ 'class' => 'mw-changeslist-links' ],
801 Html
::rawElement( 'span', [], $rc->difflink
) .
802 Html
::rawElement( 'span', [], $histLink )
805 return ' ' . $retVal;
809 * If enhanced RC is in use, this function takes the previously cached
810 * RC lines, arranges them, and outputs the HTML
814 protected function recentChangesBlock() {
815 if ( count( $this->rc_cache
) == 0 ) {
820 foreach ( $this->rc_cache
as $block ) {
821 if ( count( $block ) < 2 ) {
822 $blockOut .= $this->recentChangesBlockLine( array_shift( $block ) );
824 $blockOut .= $this->recentChangesBlockGroup( $block );
828 if ( $blockOut === '' ) {
831 // $this->lastdate is kept up to date by recentChangesLine()
832 return Xml
::element( 'h4', null, $this->lastdate
) . "\n<div>" . $blockOut . '</div>';
836 * Returns text for the end of RC
837 * If enhanced RC is in use, returns pretty much all the text
840 public function endRecentChangesList() {
841 return $this->recentChangesBlock() . '</div>';