Go to the documentation of this file.
69 $this->skin = $obj->getSkin();
76 $this->linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
115 throw new RuntimeException(
'recentChangesLine should be implemented' );
125 $highlightColorDivs =
'';
126 foreach ( [
'none',
'c1',
'c2',
'c3',
'c4',
'c5' ]
as $color ) {
130 'class' =>
'mw-rcfilters-ui-highlights-color-' . $color,
131 'data-color' => $color
138 [
'class' =>
'mw-rcfilters-ui-highlights' ],
148 $this->watchlist =
$value;
164 if ( !isset( $this->
message ) ) {
166 'cur',
'diff',
'hist',
'enhancedrc-history',
'last',
'blocklink',
'history',
167 'semicolon-separator',
'pipe-separator' ]
as $msg
169 $this->
message[$msg] = $this->
msg( $msg )->escaped();
182 foreach ( array_keys( $this->
getConfig()->
get(
'RecentChangesFlags' ) )
as $flag ) {
183 $f .= isset( $flags[$flag] ) && $flags[$flag]
200 $classes = [ self::CSS_CLASS_PREFIX .
'line' ];
201 $logType = $rc->mAttribs[
'rc_log_type'];
204 $classes[] = self::CSS_CLASS_PREFIX .
'log';
205 $classes[] = Sanitizer::escapeClass( self::CSS_CLASS_PREFIX .
'log-' . $logType );
207 $classes[] = self::CSS_CLASS_PREFIX .
'edit';
208 $classes[] = Sanitizer::escapeClass( self::CSS_CLASS_PREFIX .
'ns' .
209 $rc->mAttribs[
'rc_namespace'] .
'-' . $rc->mAttribs[
'rc_title'] );
214 $classes[] = $watched && $rc->mAttribs[
'rc_timestamp'] >= $watched
215 ? self::CSS_CLASS_PREFIX .
'line-watched'
216 : self::CSS_CLASS_PREFIX .
'line-not-watched';
233 $classes[] = Sanitizer::escapeClass( self::CSS_CLASS_PREFIX .
'ns-' .
234 $rc->mAttribs[
'rc_namespace'] );
236 if ( $this->filterGroups !==
null ) {
237 foreach ( $this->filterGroups
as $filterGroup ) {
238 foreach ( $filterGroup->getFilters()
as $filter ) {
239 $filter->applyCssClassIfNeeded( $this, $rc, $classes );
256 static $map = [
'minoredit' =>
'minor',
'botedit' =>
'bot' ];
257 static $flagInfos =
null;
259 if ( is_null( $flagInfos ) ) {
263 $flagInfos[$key][
'letter'] =
$value[
'letter'];
264 $flagInfos[$key][
'title'] =
$value[
'title'];
266 $flagInfos[$key][
'class'] =
$value[
'class'] ?? $key;
273 if ( isset( $map[$flag] ) ) {
277 $info = $flagInfos[$flag];
279 'class' => $info[
'class'],
289 $this->rc_cache = [];
290 $this->rcMoveIndex = 0;
291 $this->rcCacheIndex = 0;
292 $this->lastdate =
'';
293 $this->rclistOpen =
false;
294 $this->
getOutput()->addModuleStyles(
'mediawiki.special.changeslist' );
296 return '<div class="mw-changeslist">';
323 $szdiff = $new - $old;
328 static $fastCharDiff = [];
329 if ( !isset( $fastCharDiff[
$code] ) ) {
330 $fastCharDiff[
$code] = $config->get(
'MiserMode' )
331 ||
$context->
msg(
'rc-change-size' )->plain() ===
'$1';
334 $formattedSize =
$lang->formatNum( $szdiff );
336 if ( !$fastCharDiff[
$code] ) {
337 $formattedSize =
$context->
msg(
'rc-change-size', $formattedSize )->text();
340 if ( abs( $szdiff ) > abs( $config->get(
'RCChangedSizeThreshold' ) ) ) {
346 if ( $szdiff === 0 ) {
347 $formattedSizeClass =
'mw-plusminus-null';
348 } elseif ( $szdiff > 0 ) {
349 $formattedSize =
'+' . $formattedSize;
350 $formattedSizeClass =
'mw-plusminus-pos';
352 $formattedSizeClass =
'mw-plusminus-neg';
355 $formattedTotalSize =
$context->
msg(
'rc-change-size-new' )->numParams( $new )->text();
358 [
'dir' =>
'ltr',
'class' => $formattedSizeClass,
'title' => $formattedTotalSize ],
359 $context->
msg(
'parentheses', $formattedSize )->plain() ) .
$lang->getDirMark();
370 $oldlen = $old->mAttribs[
'rc_old_len'];
373 $newlen = $new->mAttribs[
'rc_new_len'];
375 $newlen = $old->mAttribs[
'rc_new_len'];
378 if ( $oldlen ===
null || $newlen ===
null ) {
390 $out = $this->rclistOpen ?
"</ul>\n" :
'';
401 # Make date header if necessary
403 if ( $date != $this->lastdate ) {
404 if ( $this->lastdate !=
'' ) {
407 $s .=
Xml::element(
'h4',
null, $date ) .
"\n<ul class=\"special\">";
408 $this->lastdate = $date;
409 $this->rclistOpen =
true;
419 $page =
new LogPage( $logtype );
420 $logname = $page->getName()->setContext( $this->
getContext() )->text();
421 $s .= $this->
msg(
'parentheses' )->rawParams(
422 $this->linkRenderer->makeKnownLink(
$title, $logname )
434 $rc->mAttribs[
'rc_type'] ==
RC_NEW ||
435 $rc->mAttribs[
'rc_type'] ==
RC_LOG ||
438 $diffLink = $this->
message[
'diff'];
440 $diffLink = $this->
message[
'diff'];
443 'curid' => $rc->mAttribs[
'rc_cur_id'],
444 'diff' => $rc->mAttribs[
'rc_this_oldid'],
445 'oldid' => $rc->mAttribs[
'rc_last_oldid']
448 $diffLink = $this->linkRenderer->makeKnownLink(
451 [
'class' =>
'mw-changeslist-diff' ],
456 $diffhist = $diffLink . $this->
message[
'pipe-separator'] . $this->
message[
'hist'];
458 $diffhist = $diffLink . $this->
message[
'pipe-separator'];
460 $diffhist .= $this->linkRenderer->makeKnownLink(
463 [
'class' =>
'mw-changeslist-history' ],
465 'curid' => $rc->mAttribs[
'rc_cur_id'],
466 'action' =>
'history'
472 $s .= $this->
msg(
'parentheses' )->rawParams( $diffhist )->escaped() .
473 ' <span class="mw-changeslist-separator">. .</span> ';
496 if ( $rc->getTitle()->isRedirect() ) {
497 $params = [
'redirect' =>
'no' ];
500 $articlelink = $this->linkRenderer->makeLink(
503 [
'class' =>
'mw-changeslist-title' ],
507 $articlelink =
'<span class="history-deleted">' . $articlelink .
'</span>';
509 # To allow for boldening pages watched by this user
510 $articlelink =
"<span class=\"mw-title\">{$articlelink}</span>";
512 $articlelink .= $this->
getLanguage()->getDirMark();
514 # TODO: Deprecate the $s argument, it seems happily unused.
516 # Avoid PHP 7.1 warning from passing $this by reference
519 [ &
$changesList, &$articlelink, &
$s, &$rc, $unpatrolled, $watched ] );
521 return "{$s} {$articlelink}";
533 return $this->
message[
'semicolon-separator'] .
'<span class="mw-changeslist-date">' .
535 $rc->mAttribs[
'rc_timestamp'],
537 ) ) .
'</span> <span class="mw-changeslist-separator">. .</span> ';
558 $s .=
' <span class="history-deleted">' .
559 $this->
msg(
'rev-deleted-user' )->escaped() .
'</span>';
562 $rc->mAttribs[
'rc_user_text'] );
575 $formatter->setContext( $this->
getContext() );
576 $formatter->setShowUserToolLinks(
true );
579 return $formatter->getActionText() .
" $mark" . $formatter->getComment();
589 return ' <span class="history-deleted">' .
590 $this->
msg(
'rev-deleted-comment' )->escaped() .
'</span>';
606 return $this->watchMsgCache->getWithSetCallback(
607 "watching-users-msg:$count",
608 function ()
use ( $count ) {
609 return $this->
msg(
'number_of_watching_users_RCview' )
610 ->numParams( $count )->escaped();
622 return ( $rc->mAttribs[
'rc_deleted'] & $field ) == $field;
634 if ( $rc->mAttribs[
'rc_type'] ==
RC_LOG ) {
648 return '<strong class="mw-watched">' .
$link .
'</strong>';
650 return '<span class="mw-rc-unwatched">' .
$link .
'</span>';
661 if ( $rc->mAttribs[
'rc_type'] ==
RC_EDIT
662 && $rc->mAttribs[
'rc_this_oldid']
663 && $rc->mAttribs[
'rc_cur_id']
664 && $rc->getAttribute(
'page_latest' ) == $rc->mAttribs[
'rc_this_oldid']
669 if (
$title->quickUserCan(
'rollback', $this->getUser() ) ) {
672 'id' => $rc->mAttribs[
'rc_this_oldid'],
673 'user' => $rc->mAttribs[
'rc_user'],
674 'user_text' => $rc->mAttribs[
'rc_user_text'],
675 'actor' => $rc->mAttribs[
'rc_actor'] ??
null,
676 'deleted' => $rc->mAttribs[
'rc_deleted']
700 if ( empty( $rc->mAttribs[
'ts_tags'] ) ) {
705 $rc->mAttribs[
'ts_tags'],
709 $classes = array_merge( $classes, $newClasses );
710 $s .=
' ' . $tagSummary;
740 $isPatrolled = $rc->mAttribs[
'rc_patrolled'];
741 $rcType = $rc->mAttribs[
'rc_type'];
742 $rcLogType = $rc->mAttribs[
'rc_log_type'];
744 $isPatrolled = $rc->rc_patrolled;
745 $rcType = $rc->rc_type;
746 $rcLogType = $rc->rc_log_type;
749 if ( !$isPatrolled ) {
750 if (
$user->useRCPatrol() ) {
756 if (
$user->useFilePatrol() && $rcLogType ==
'upload' ) {
774 return intval( $rcObj->getAttribute(
'rc_type' ) ) ===
RC_CATEGORIZE
775 && intval( $rcObj->getAttribute(
'rc_this_oldid' ) ) === 0;
790 $attrs[
'data-mw-revid'] = $rc->mAttribs[
'rc_this_oldid'];
793 $attrs[
'data-mw-logid'] = $rc->mAttribs[
'rc_logid'];
794 $attrs[
'data-mw-logaction'] =
795 $rc->mAttribs[
'rc_log_type'] .
'/' . $rc->mAttribs[
'rc_log_action'];
799 $attrs[
'data-mw-ts' ] = $rc->
getAttribute(
'rc_timestamp' );
812 $this->changeLinePrefixer = $prefixer;
endRecentChangesList()
Returns text for the end of RC.
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account $user
getContext()
Get the base IContextSource object.
Marks HTML that shouldn't be escaped.
insertComment( $rc)
Insert a formatted comment.
setWatchlistDivs( $value=true)
Sets the list to use a "<li class='watchlist-(namespace)-(page)'>" tag.
setChangeLinePrefixer(callable $prefixer)
Sets the callable that generates a change line prefix added to the beginning of each line.
static userCanBitfield( $bitfield, $field, User $user=null, Title $title=null)
Determine if the current user is allowed to view a particular field of this revision,...
static userLink( $userId, $userName, $altUserName=false)
Make user link (or user contributions for unregistered users)
if(!isset( $args[0])) $lang
msg( $key)
Get a Message object with context set Parameters are the same as wfMessage()
Utility class for creating new RC entries.
MapCacheLRU $watchMsgCache
maybeWatchedLink( $link, $watched=false)
return true to allow those checks to and false if checking is done remove or add to the links of a group of changes in EnhancedChangesList Hook subscribers can return false to omit this line from recentchanges $changesList
insertLog(&$s, $title, $logtype)
getTags(RecentChange $rc, array &$classes)
getHighlightsContainerDiv()
Get the container for highlights that are used in the new StructuredFilters system.
formatCharacterDifference(RecentChange $old, RecentChange $new=null)
Format the character difference of one or several changes.
static isDeleted( $rc, $field)
Determine if said field of a revision is hidden.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
insertDateHeader(&$s, $rc_timestamp)
null for the wiki Added should default to null in handler for backwards compatibility add a value to it if you want to add a cookie that have to vary cache options can modify $query
$wgRecentChangesFlags
Flags (letter symbols) shown in recent changes and watchlist to indicate certain types of edits.
namespace and then decline to actually register it file or subcat img or subcat $title
static generateRollback( $rev, IContextSource $context=null, $options=[ 'verify'])
Generate a rollback link for a given revision.
insertLogEntry( $rc)
Insert a formatted action.
The simplest way of implementing IContextSource is to hold a RequestContext as a member variable and ...
insertTags(&$s, &$rc, &$classes)
Class to simplify the use of log pages.
static element( $element, $attribs=null, $contents='', $allowShortTag=true)
Format an XML element with given attributes and, optionally, text content.
Handles a simple LRU key/value map with a maximum number of entries.
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output modifiable & $code
static flag( $flag, IContextSource $context=null)
Make an "<abbr>" element for a given change flag.
msg( $key)
This is the method for getting translated interface messages.
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))
insertUserRelatedLinks(&$s, &$rc)
Insert links to user page, user talk page and eventually a blocking link.
setContext(IContextSource $context)
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
getRollback(RecentChange $rc)
getArticleLink(&$rc, $unpatrolled, $watched)
static newFromContext(IContextSource $context, array $groups=[])
Fetch an appropriate changes list class for the specified context Some users might want to use an enh...
callable $changeLinePrefixer
getDataAttributes(RecentChange $rc)
Get recommended data attributes for a change line.
static userToolLinks( $userId, $userText, $redContribsWhenNoEdits=false, $flags=0, $edits=null)
Generate standard user tool links (talk, contributions, block link, etc.)
insertTimestamp(&$s, $rc)
Insert time timestamp string from $rc into $s.
numberofWatchingusers( $count)
Returns the string which indicates the number of watching users.
showAsUnpatrolled(RecentChange $rc)
static showCharacterDifference( $old, $new, IContextSource $context=null)
Show formatted char difference.
preCacheMessages()
As we use the same small set of messages in various methods and that they are called often,...
static getMain()
Get the RequestContext object associated with the main request.
insertArticleLink(&$s, RecentChange $rc, $unpatrolled, $watched)
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation use $formDescriptor instead default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a message
Interface for objects which can provide a MediaWiki context on request.
getHTMLClasses( $rc, $watched)
Get an array of default HTML class attributes for the change.
__construct( $obj, array $filterGroups=[])
Changeslist constructor.
getAttribute( $name)
Get an attribute value.
This list may contain false positives That usually means there is additional text with links below the first Each row contains links to the first and second as well as the first line of the second redirect text
recentChangesFlags( $flags, $nothing="\u{00A0}")
Returns the appropriate flags for new page, minor change and patrolling.
beginRecentChangesList()
Returns text for the start of the tabular part of RC.
insertDiffHist(&$s, &$rc, $unpatrolled=null)
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction $rows
static userCanBitfield( $bitfield, $field, User $user=null)
Determine if the current user is allowed to view a particular field of this log row,...
initChangesListRows( $rows)
getConfig()
Get the site configuration.
isCategorizationWithoutRevision( $rcObj)
Determines whether a revision is linked to this change; this may not be the case when the categorizat...
presenting them properly to the user as errors is done by the caller return true use this to change the list i e etc $rev
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
static rawElement( $element, $attribs=[], $contents='')
Returns an HTML element in a string.
static commentBlock( $comment, $title=null, $local=false, $wikiId=null)
Wrap a comment in standard punctuation and formatting if it's non-empty, otherwise return empty strin...
usually copyright or history_copyright This message must be in HTML not wikitext & $link
getTimestamp( $rc)
Get the timestamp from $rc formatted with current user's settings and a separator.
static isUnpatrolled( $rc, User $user)
static element( $element, $attribs=[], $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency MediaWikiServices
The main skin class which provides methods and properties for all other skins.
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation use $formDescriptor instead default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "<
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
getHTMLClassesForFilters( $rc)
Get an array of CSS classes attributed to filters for this row.
recentChangesLine(&$rc, $watched=false, $linenumber=null)
Format a line.
static userCan( $rc, $field, User $user=null)
Determine if the current user is allowed to view a particular field of this revision,...
insertExtra(&$s, &$rc, &$classes)
insertRollback(&$s, &$rc)
Insert a rollback link.
LinkRenderer $linkRenderer
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output $out