3 * Base class for all changes lists.
5 * The class is used for formatting recent changes, related changes and watchlist.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 * http://www.gnu.org/copyleft/gpl.html
24 use MediaWiki\Linker\LinkRenderer
;
25 use MediaWiki\MediaWikiServices
;
26 use MediaWiki\Storage\RevisionRecord
;
27 use Wikimedia\Rdbms\IResultWrapper
;
29 class ChangesList
extends ContextSource
{
30 const CSS_CLASS_PREFIX
= 'mw-changeslist-';
37 protected $watchlist = false;
41 protected $rcCacheIndex;
42 protected $rclistOpen;
43 protected $rcMoveIndex;
46 protected $changeLinePrefixer;
48 /** @var MapCacheLRU */
49 protected $watchMsgCache;
54 protected $linkRenderer;
59 protected $filterGroups;
62 * @param Skin|IContextSource $obj
63 * @param array $filterGroups Array of ChangesListFilterGroup objects (currently optional)
65 public function __construct( $obj, array $filterGroups = [] ) {
66 if ( $obj instanceof IContextSource
) {
67 $this->setContext( $obj );
68 $this->skin
= $obj->getSkin();
70 $this->setContext( $obj->getContext() );
73 $this->preCacheMessages();
74 $this->watchMsgCache
= new MapCacheLRU( 50 );
75 $this->linkRenderer
= MediaWikiServices
::getInstance()->getLinkRenderer();
76 $this->filterGroups
= $filterGroups;
80 * Fetch an appropriate changes list class for the specified context
81 * Some users might want to use an enhanced list format, for instance
83 * @param IContextSource $context
84 * @param array $groups Array of ChangesListFilterGroup objects (currently optional)
87 public static function newFromContext( IContextSource
$context, array $groups = [] ) {
88 $user = $context->getUser();
89 $sk = $context->getSkin();
91 if ( Hooks
::run( 'FetchChangesList', [ $user, &$sk, &$list, $groups ] ) ) {
92 $new = $context->getRequest()->getBool( 'enhanced', $user->getOption( 'usenewrc' ) );
95 new EnhancedChangesList( $context, $groups ) :
96 new OldChangesList( $context, $groups );
107 * @param RecentChange &$rc Passed by reference
108 * @param bool $watched (default false)
109 * @param int|null $linenumber (default null)
111 * @return string|bool
113 public function recentChangesLine( &$rc, $watched = false, $linenumber = null ) {
114 throw new RuntimeException( 'recentChangesLine should be implemented' );
118 * Get the container for highlights that are used in the new StructuredFilters
121 * @return string HTML structure of the highlight container div
123 protected function getHighlightsContainerDiv() {
124 $highlightColorDivs = '';
125 foreach ( [ 'none', 'c1', 'c2', 'c3', 'c4', 'c5' ] as $color ) {
126 $highlightColorDivs .= Html
::rawElement(
129 'class' => 'mw-rcfilters-ui-highlights-color-' . $color,
130 'data-color' => $color
135 return Html
::rawElement(
137 [ 'class' => 'mw-rcfilters-ui-highlights' ],
143 * Sets the list to use a "<li class='watchlist-(namespace)-(page)'>" tag
146 public function setWatchlistDivs( $value = true ) {
147 $this->watchlist
= $value;
151 * @return bool True when setWatchlistDivs has been called
154 public function isWatchlist() {
155 return (bool)$this->watchlist
;
159 * As we use the same small set of messages in various methods and that
160 * they are called often, we call them once and save them in $this->message
162 private function preCacheMessages() {
163 if ( !isset( $this->message
) ) {
165 'cur', 'diff', 'hist', 'enhancedrc-history', 'last', 'blocklink', 'history',
166 'semicolon-separator', 'pipe-separator' ] as $msg
168 $this->message
[$msg] = $this->msg( $msg )->escaped();
174 * Returns the appropriate flags for new page, minor change and patrolling
175 * @param array $flags Associative array of 'flag' => Bool
176 * @param string $nothing To use for empty space
179 public function recentChangesFlags( $flags, $nothing = "\u{00A0}" ) {
181 foreach ( array_keys( $this->getConfig()->get( 'RecentChangesFlags' ) ) as $flag ) {
182 $f .= isset( $flags[$flag] ) && $flags[$flag]
183 ? self
::flag( $flag, $this->getContext() )
191 * Get an array of default HTML class attributes for the change.
193 * @param RecentChange|RCCacheEntry $rc
194 * @param string|bool $watched Optionally timestamp for adding watched class
196 * @return string[] List of CSS class names
198 protected function getHTMLClasses( $rc, $watched ) {
199 $classes = [ self
::CSS_CLASS_PREFIX
. 'line' ];
200 $logType = $rc->mAttribs
['rc_log_type'];
203 $classes[] = self
::CSS_CLASS_PREFIX
. 'log';
204 $classes[] = Sanitizer
::escapeClass( self
::CSS_CLASS_PREFIX
. 'log-' . $logType );
206 $classes[] = self
::CSS_CLASS_PREFIX
. 'edit';
207 $classes[] = Sanitizer
::escapeClass( self
::CSS_CLASS_PREFIX
. 'ns' .
208 $rc->mAttribs
['rc_namespace'] . '-' . $rc->mAttribs
['rc_title'] );
211 // Indicate watched status on the line to allow for more
212 // comprehensive styling.
213 $classes[] = $watched && $rc->mAttribs
['rc_timestamp'] >= $watched
214 ? self
::CSS_CLASS_PREFIX
. 'line-watched'
215 : self
::CSS_CLASS_PREFIX
. 'line-not-watched';
217 $classes = array_merge( $classes, $this->getHTMLClassesForFilters( $rc ) );
223 * Get an array of CSS classes attributed to filters for this row. Used for highlighting
226 * @param RecentChange $rc
227 * @return array Array of CSS classes
229 protected function getHTMLClassesForFilters( $rc ) {
232 $classes[] = Sanitizer
::escapeClass( self
::CSS_CLASS_PREFIX
. 'ns-' .
233 $rc->mAttribs
['rc_namespace'] );
235 $nsInfo = MediaWikiServices
::getInstance()->getNamespaceInfo();
236 $classes[] = Sanitizer
::escapeClass(
237 self
::CSS_CLASS_PREFIX
.
239 ( $nsInfo->isTalk( $rc->mAttribs
['rc_namespace'] ) ?
'talk' : 'subject' )
242 if ( $this->filterGroups
!== null ) {
243 foreach ( $this->filterGroups
as $filterGroup ) {
244 foreach ( $filterGroup->getFilters() as $filter ) {
245 $filter->applyCssClassIfNeeded( $this, $rc, $classes );
254 * Make an "<abbr>" element for a given change flag. The flag indicating a new page, minor edit,
255 * bot edit, or unpatrolled edit. In English it typically contains "N", "m", "b", or "!".
257 * @param string $flag One key of $wgRecentChangesFlags
258 * @param IContextSource|null $context
259 * @return string HTML
261 public static function flag( $flag, IContextSource
$context = null ) {
262 static $map = [ 'minoredit' => 'minor', 'botedit' => 'bot' ];
263 static $flagInfos = null;
265 if ( is_null( $flagInfos ) ) {
266 global $wgRecentChangesFlags;
268 foreach ( $wgRecentChangesFlags as $key => $value ) {
269 $flagInfos[$key]['letter'] = $value['letter'];
270 $flagInfos[$key]['title'] = $value['title'];
271 // Allow customized class name, fall back to flag name
272 $flagInfos[$key]['class'] = $value['class'] ??
$key;
276 $context = $context ?
: RequestContext
::getMain();
278 // Inconsistent naming, kepted for b/c
279 if ( isset( $map[$flag] ) ) {
283 $info = $flagInfos[$flag];
284 return Html
::element( 'abbr', [
285 'class' => $info['class'],
286 'title' => wfMessage( $info['title'] )->setContext( $context )->text(),
287 ], wfMessage( $info['letter'] )->setContext( $context )->text() );
291 * Returns text for the start of the tabular part of RC
294 public function beginRecentChangesList() {
295 $this->rc_cache
= [];
296 $this->rcMoveIndex
= 0;
297 $this->rcCacheIndex
= 0;
298 $this->lastdate
= '';
299 $this->rclistOpen
= false;
300 $this->getOutput()->addModuleStyles( [
301 'mediawiki.interface.helpers.styles',
302 'mediawiki.special.changeslist'
305 return '<div class="mw-changeslist">';
309 * @param IResultWrapper|array $rows
311 public function initChangesListRows( $rows ) {
312 Hooks
::run( 'ChangesListInitRows', [ $this, $rows ] );
316 * Show formatted char difference
318 * Needs the css module 'mediawiki.special.changeslist' to style output
320 * @param int $old Number of bytes
321 * @param int $new Number of bytes
322 * @param IContextSource|null $context
325 public static function showCharacterDifference( $old, $new, IContextSource
$context = null ) {
327 $context = RequestContext
::getMain();
332 $szdiff = $new - $old;
334 $lang = $context->getLanguage();
335 $config = $context->getConfig();
336 $code = $lang->getCode();
337 static $fastCharDiff = [];
338 if ( !isset( $fastCharDiff[$code] ) ) {
339 $fastCharDiff[$code] = $config->get( 'MiserMode' )
340 ||
$context->msg( 'rc-change-size' )->plain() === '$1';
343 $formattedSize = $lang->formatNum( $szdiff );
345 if ( !$fastCharDiff[$code] ) {
346 $formattedSize = $context->msg( 'rc-change-size', $formattedSize )->text();
349 if ( abs( $szdiff ) > abs( $config->get( 'RCChangedSizeThreshold' ) ) ) {
355 if ( $szdiff === 0 ) {
356 $formattedSizeClass = 'mw-plusminus-null';
357 } elseif ( $szdiff > 0 ) {
358 $formattedSize = '+' . $formattedSize;
359 $formattedSizeClass = 'mw-plusminus-pos';
361 $formattedSizeClass = 'mw-plusminus-neg';
363 $formattedSizeClass .= ' mw-diff-bytes';
365 $formattedTotalSize = $context->msg( 'rc-change-size-new' )->numParams( $new )->text();
367 return Html
::element( $tag,
368 [ 'dir' => 'ltr', 'class' => $formattedSizeClass, 'title' => $formattedTotalSize ],
369 $formattedSize ) . $lang->getDirMark();
373 * Format the character difference of one or several changes.
375 * @param RecentChange $old
376 * @param RecentChange|null $new Last change to use, if not provided, $old will be used
377 * @return string HTML fragment
379 public function formatCharacterDifference( RecentChange
$old, RecentChange
$new = null ) {
380 $oldlen = $old->mAttribs
['rc_old_len'];
383 $newlen = $new->mAttribs
['rc_new_len'];
385 $newlen = $old->mAttribs
['rc_new_len'];
388 if ( $oldlen === null ||
$newlen === null ) {
392 return self
::showCharacterDifference( $oldlen, $newlen, $this->getContext() );
396 * Returns text for the end of RC
399 public function endRecentChangesList() {
400 $out = $this->rclistOpen ?
"</ul>\n" : '';
407 * Render the date and time of a revision in the current user language
408 * based on whether the user is able to view this information or not.
409 * @param Revision $rev
411 * @param Language $lang
412 * @param Title|null $title (optional) where Title does not match
413 * the Title associated with the Revision
414 * @internal For usage by Pager classes only (e.g. HistoryPager and ContribsPager).
415 * @return string HTML
417 public static function revDateLink( Revision
$rev, User
$user, Language
$lang, $title = null ) {
418 $ts = $rev->getTimestamp();
419 $date = $lang->userTimeAndDate( $ts, $user );
420 if ( $rev->userCan( RevisionRecord
::DELETED_TEXT
, $user ) ) {
421 $link = MediaWikiServices
::getInstance()->getLinkRenderer()->makeKnownLink(
422 $title ??
$rev->getTitle(),
424 [ 'class' => 'mw-changeslist-date' ],
425 [ 'oldid' => $rev->getId() ]
428 $link = htmlspecialchars( $date );
430 if ( $rev->isDeleted( RevisionRecord
::DELETED_TEXT
) ) {
431 $link = "<span class=\"history-deleted mw-changeslist-date\">$link</span>";
437 * @param string &$s HTML to update
438 * @param mixed $rc_timestamp
440 public function insertDateHeader( &$s, $rc_timestamp ) {
441 # Make date header if necessary
442 $date = $this->getLanguage()->userDate( $rc_timestamp, $this->getUser() );
443 if ( $date != $this->lastdate
) {
444 if ( $this->lastdate
!= '' ) {
447 $s .= Xml
::element( 'h4', null, $date ) . "\n<ul class=\"special\">";
448 $this->lastdate
= $date;
449 $this->rclistOpen
= true;
454 * @param string &$s HTML to update
455 * @param Title $title
456 * @param string $logtype
458 public function insertLog( &$s, $title, $logtype ) {
459 $page = new LogPage( $logtype );
460 $logname = $page->getName()->setContext( $this->getContext() )->text();
461 $s .= Html
::rawElement( 'span', [
462 'class' => 'mw-changeslist-links'
463 ], $this->linkRenderer
->makeKnownLink( $title, $logname ) );
467 * @param string &$s HTML to update
468 * @param RecentChange &$rc
469 * @param bool|null $unpatrolled Unused variable, since 1.27.
471 public function insertDiffHist( &$s, &$rc, $unpatrolled = null ) {
474 $rc->mAttribs
['rc_type'] == RC_NEW ||
475 $rc->mAttribs
['rc_type'] == RC_LOG ||
476 $rc->mAttribs
['rc_type'] == RC_CATEGORIZE
478 $diffLink = $this->message
['diff'];
479 } elseif ( !self
::userCan( $rc, RevisionRecord
::DELETED_TEXT
, $this->getUser() ) ) {
480 $diffLink = $this->message
['diff'];
483 'curid' => $rc->mAttribs
['rc_cur_id'],
484 'diff' => $rc->mAttribs
['rc_this_oldid'],
485 'oldid' => $rc->mAttribs
['rc_last_oldid']
488 $diffLink = $this->linkRenderer
->makeKnownLink(
490 new HtmlArmor( $this->message
['diff'] ),
491 [ 'class' => 'mw-changeslist-diff' ],
495 if ( $rc->mAttribs
['rc_type'] == RC_CATEGORIZE
) {
496 $histLink = $this->message
['hist'];
498 $histLink = $this->linkRenderer
->makeKnownLink(
500 new HtmlArmor( $this->message
['hist'] ),
501 [ 'class' => 'mw-changeslist-history' ],
503 'curid' => $rc->mAttribs
['rc_cur_id'],
504 'action' => 'history'
509 $s .= Html
::rawElement( 'div', [ 'class' => 'mw-changeslist-links' ],
510 Html
::rawElement( 'span', [], $diffLink ) .
511 Html
::rawElement( 'span', [], $histLink )
513 ' <span class="mw-changeslist-separator"></span> ';
517 * @param RecentChange &$rc
518 * @param bool $unpatrolled
519 * @param bool $watched
520 * @return string HTML
523 public function getArticleLink( &$rc, $unpatrolled, $watched ) {
525 if ( $rc->getTitle()->isRedirect() ) {
526 $params = [ 'redirect' => 'no' ];
529 $articlelink = $this->linkRenderer
->makeLink(
532 [ 'class' => 'mw-changeslist-title' ],
535 if ( $this->isDeleted( $rc, RevisionRecord
::DELETED_TEXT
) ) {
536 $articlelink = '<span class="history-deleted">' . $articlelink . '</span>';
538 # To allow for boldening pages watched by this user
539 $articlelink = "<span class=\"mw-title\">{$articlelink}</span>";
541 $articlelink .= $this->getLanguage()->getDirMark();
543 # TODO: Deprecate the $s argument, it seems happily unused.
545 # Avoid PHP 7.1 warning from passing $this by reference
546 $changesList = $this;
547 Hooks
::run( 'ChangesListInsertArticleLink',
548 [ &$changesList, &$articlelink, &$s, &$rc, $unpatrolled, $watched ] );
550 return "{$s} {$articlelink}";
554 * Get the timestamp from $rc formatted with current user's settings
557 * @param RecentChange $rc
558 * @deprecated use revDateLink instead.
559 * @return string HTML fragment
561 public function getTimestamp( $rc ) {
562 // @todo FIXME: Hard coded ". .". Is there a message for this? Should there be?
563 return $this->message
['semicolon-separator'] . '<span class="mw-changeslist-date">' .
564 htmlspecialchars( $this->getLanguage()->userTime(
565 $rc->mAttribs
['rc_timestamp'],
567 ) ) . '</span> <span class="mw-changeslist-separator"></span> ';
571 * Insert time timestamp string from $rc into $s
573 * @param string &$s HTML to update
574 * @param RecentChange $rc
576 public function insertTimestamp( &$s, $rc ) {
577 $s .= $this->getTimestamp( $rc );
581 * Insert links to user page, user talk page and eventually a blocking link
583 * @param string &$s HTML to update
584 * @param RecentChange &$rc
586 public function insertUserRelatedLinks( &$s, &$rc ) {
587 if ( $this->isDeleted( $rc, RevisionRecord
::DELETED_USER
) ) {
588 $s .= ' <span class="history-deleted">' .
589 $this->msg( 'rev-deleted-user' )->escaped() . '</span>';
591 $s .= $this->getLanguage()->getDirMark() . Linker
::userLink( $rc->mAttribs
['rc_user'],
592 $rc->mAttribs
['rc_user_text'] );
593 $s .= Linker
::userToolLinks(
594 $rc->mAttribs
['rc_user'], $rc->mAttribs
['rc_user_text'],
596 // The text content of tools is not wrapped with parenthesises or "piped".
597 // This will be handled in CSS (T205581).
604 * Insert a formatted action
606 * @param RecentChange $rc
609 public function insertLogEntry( $rc ) {
610 $formatter = LogFormatter
::newFromRow( $rc->mAttribs
);
611 $formatter->setContext( $this->getContext() );
612 $formatter->setShowUserToolLinks( true );
613 $mark = $this->getLanguage()->getDirMark();
615 return Html
::openElement( 'span', [ 'class' => 'mw-changeslist-log-entry' ] )
616 . $formatter->getActionText() . " $mark" . $formatter->getComment()
617 . Html
::closeElement( 'span' );
621 * Insert a formatted comment
622 * @param RecentChange $rc
625 public function insertComment( $rc ) {
626 if ( $this->isDeleted( $rc, RevisionRecord
::DELETED_COMMENT
) ) {
627 return ' <span class="history-deleted">' .
628 $this->msg( 'rev-deleted-comment' )->escaped() . '</span>';
630 return Linker
::commentBlock( $rc->mAttribs
['rc_comment'], $rc->getTitle(),
631 // Whether section links should refer to local page (using default false)
633 // wikid to generate links for (using default null) */
635 // whether parentheses should be rendered as part of the message
641 * Returns the string which indicates the number of watching users
642 * @param int $count Number of user watching a page
645 protected function numberofWatchingusers( $count ) {
650 return $this->watchMsgCache
->getWithSetCallback(
651 "watching-users-msg:$count",
652 function () use ( $count ) {
653 return $this->msg( 'number-of-watching-users-for-recent-changes' )
654 ->numParams( $count )->escaped();
660 * Determine if said field of a revision is hidden
661 * @param RCCacheEntry|RecentChange $rc
662 * @param int $field One of DELETED_* bitfield constants
665 public static function isDeleted( $rc, $field ) {
666 return ( $rc->mAttribs
['rc_deleted'] & $field ) == $field;
670 * Determine if the current user is allowed to view a particular
671 * field of this revision, if it's marked as deleted.
672 * @param RCCacheEntry|RecentChange $rc
674 * @param User|null $user User object to check against. If null, the global RequestContext's
675 * User is assumed instead.
678 public static function userCan( $rc, $field, User
$user = null ) {
679 if ( $user === null ) {
680 $user = RequestContext
::getMain()->getUser();
683 if ( $rc->mAttribs
['rc_type'] == RC_LOG
) {
684 return LogEventsList
::userCanBitfield( $rc->mAttribs
['rc_deleted'], $field, $user );
687 return RevisionRecord
::userCanBitfield( $rc->mAttribs
['rc_deleted'], $field, $user );
691 * @param string $link
692 * @param bool $watched
695 protected function maybeWatchedLink( $link, $watched = false ) {
697 return '<strong class="mw-watched">' . $link . '</strong>';
699 return '<span class="mw-rc-unwatched">' . $link . '</span>';
704 * Insert a rollback link
707 * @param RecentChange &$rc
709 public function insertRollback( &$s, &$rc ) {
710 if ( $rc->mAttribs
['rc_type'] == RC_EDIT
711 && $rc->mAttribs
['rc_this_oldid']
712 && $rc->mAttribs
['rc_cur_id']
713 && $rc->getAttribute( 'page_latest' ) == $rc->mAttribs
['rc_this_oldid']
715 $title = $rc->getTitle();
716 /** Check for rollback permissions, disallow special pages, and only
717 * show a link on the top-most revision
719 if ( $title->quickUserCan( 'rollback', $this->getUser() ) ) {
720 $rev = new Revision( [
722 'id' => $rc->mAttribs
['rc_this_oldid'],
723 'user' => $rc->mAttribs
['rc_user'],
724 'user_text' => $rc->mAttribs
['rc_user_text'],
725 'actor' => $rc->mAttribs
['rc_actor'] ??
null,
726 'deleted' => $rc->mAttribs
['rc_deleted']
728 $s .= ' ' . Linker
::generateRollback( $rev, $this->getContext(),
735 * @param RecentChange $rc
739 public function getRollback( RecentChange
$rc ) {
741 $this->insertRollback( $s, $rc );
747 * @param RecentChange &$rc
748 * @param array &$classes
750 public function insertTags( &$s, &$rc, &$classes ) {
751 if ( empty( $rc->mAttribs
['ts_tags'] ) ) {
755 list( $tagSummary, $newClasses ) = ChangeTags
::formatSummaryRow(
756 $rc->mAttribs
['ts_tags'],
760 $classes = array_merge( $classes, $newClasses );
761 $s .= ' ' . $tagSummary;
765 * @param RecentChange $rc
766 * @param array &$classes
770 public function getTags( RecentChange
$rc, array &$classes ) {
772 $this->insertTags( $s, $rc, $classes );
776 public function insertExtra( &$s, &$rc, &$classes ) {
777 // Empty, used for subclasses to add anything special.
780 protected function showAsUnpatrolled( RecentChange
$rc ) {
781 return self
::isUnpatrolled( $rc, $this->getUser() );
785 * @param object|RecentChange $rc Database row from recentchanges or a RecentChange object
789 public static function isUnpatrolled( $rc, User
$user ) {
790 if ( $rc instanceof RecentChange
) {
791 $isPatrolled = $rc->mAttribs
['rc_patrolled'];
792 $rcType = $rc->mAttribs
['rc_type'];
793 $rcLogType = $rc->mAttribs
['rc_log_type'];
795 $isPatrolled = $rc->rc_patrolled
;
796 $rcType = $rc->rc_type
;
797 $rcLogType = $rc->rc_log_type
;
800 if ( !$isPatrolled ) {
801 if ( $user->useRCPatrol() ) {
804 if ( $user->useNPPatrol() && $rcType == RC_NEW
) {
807 if ( $user->useFilePatrol() && $rcLogType == 'upload' ) {
816 * Determines whether a revision is linked to this change; this may not be the case
817 * when the categorization wasn't done by an edit but a conditional parser function
821 * @param RecentChange|RCCacheEntry $rcObj
824 protected function isCategorizationWithoutRevision( $rcObj ) {
825 return intval( $rcObj->getAttribute( 'rc_type' ) ) === RC_CATEGORIZE
826 && intval( $rcObj->getAttribute( 'rc_this_oldid' ) ) === 0;
830 * Get recommended data attributes for a change line.
831 * @param RecentChange $rc
832 * @return string[] attribute name => value
834 protected function getDataAttributes( RecentChange
$rc ) {
837 $type = $rc->getAttribute( 'rc_source' );
839 case RecentChange
::SRC_EDIT
:
840 case RecentChange
::SRC_NEW
:
841 $attrs['data-mw-revid'] = $rc->mAttribs
['rc_this_oldid'];
843 case RecentChange
::SRC_LOG
:
844 $attrs['data-mw-logid'] = $rc->mAttribs
['rc_logid'];
845 $attrs['data-mw-logaction'] =
846 $rc->mAttribs
['rc_log_type'] . '/' . $rc->mAttribs
['rc_log_action'];
850 $attrs[ 'data-mw-ts' ] = $rc->getAttribute( 'rc_timestamp' );
856 * Sets the callable that generates a change line prefix added to the beginning of each line.
858 * @param callable $prefixer Callable to run that generates the change line prefix.
859 * Takes three parameters: a RecentChange object, a ChangesList object,
860 * and whether the current entry is a grouped entry.
862 public function setChangeLinePrefixer( callable
$prefixer ) {
863 $this->changeLinePrefixer
= $prefixer;