67 $this->skin = $obj->getSkin();
74 $this->linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
90 if ( Hooks::run(
'FetchChangesList', [
$user, &$sk, &$list ] ) ) {
113 throw new RuntimeException(
'recentChangesLine should be implemented' );
123 $highlightColorDivs =
'';
124 foreach ( [
'none',
'c1',
'c2',
'c3',
'c4',
'c5' ]
as $color ) {
125 $highlightColorDivs .= Html::rawElement(
128 'class' =>
'mw-rcfilters-ui-highlights-color-' . $color,
129 'data-color' => $color
134 return Html::rawElement(
136 [
'class' =>
'mw-rcfilters-ui-highlights' ],
146 $this->watchlist =
$value;
162 if ( !isset( $this->
message ) ) {
164 'cur',
'diff',
'hist',
'enhancedrc-history',
'last',
'blocklink',
'history',
165 'semicolon-separator',
'pipe-separator' ]
as $msg
167 $this->
message[$msg] = $this->
msg( $msg )->escaped();
180 foreach ( array_keys( $this->
getConfig()->
get(
'RecentChangesFlags' ) )
as $flag ) {
181 $f .= isset( $flags[$flag] ) && $flags[$flag]
198 $classes = [ self::CSS_CLASS_PREFIX .
'line' ];
199 $logType = $rc->mAttribs[
'rc_log_type'];
202 $classes[] = self::CSS_CLASS_PREFIX .
'log';
203 $classes[] = Sanitizer::escapeClass( self::CSS_CLASS_PREFIX .
'log-' . $logType );
205 $classes[] = self::CSS_CLASS_PREFIX .
'edit';
206 $classes[] = Sanitizer::escapeClass( self::CSS_CLASS_PREFIX .
'ns' .
207 $rc->mAttribs[
'rc_namespace'] .
'-' . $rc->mAttribs[
'rc_title'] );
212 $classes[] = $watched && $rc->mAttribs[
'rc_timestamp'] >= $watched
213 ? self::CSS_CLASS_PREFIX .
'line-watched'
214 : self::CSS_CLASS_PREFIX .
'line-not-watched';
231 $classes[] = Sanitizer::escapeClass( self::CSS_CLASS_PREFIX .
'ns-' .
232 $rc->mAttribs[
'rc_namespace'] );
234 if ( $this->filterGroups !==
null ) {
235 foreach ( $this->filterGroups
as $filterGroup ) {
236 foreach ( $filterGroup->getFilters()
as $filter ) {
237 $filter->applyCssClassIfNeeded( $this, $rc, $classes );
254 static $map = [
'minoredit' =>
'minor',
'botedit' =>
'bot' ];
255 static $flagInfos =
null;
257 if ( is_null( $flagInfos ) ) {
261 $flagInfos[$key][
'letter'] =
$value[
'letter'];
262 $flagInfos[$key][
'title'] =
$value[
'title'];
264 $flagInfos[$key][
'class'] =
$value[
'class'] ?? $key;
271 if ( isset( $map[$flag] ) ) {
275 $info = $flagInfos[$flag];
276 return Html::element(
'abbr', [
277 'class' => $info[
'class'],
287 $this->rc_cache = [];
288 $this->rcMoveIndex = 0;
289 $this->rcCacheIndex = 0;
290 $this->lastdate =
'';
291 $this->rclistOpen =
false;
293 'mediawiki.interface.helpers.styles',
294 'mediawiki.special.changeslist'
297 return '<div class="mw-changeslist">';
304 Hooks::run(
'ChangesListInitRows', [ $this,
$rows ] );
319 $context = RequestContext::getMain();
324 $szdiff = $new - $old;
329 static $fastCharDiff = [];
330 if ( !isset( $fastCharDiff[
$code] ) ) {
331 $fastCharDiff[
$code] = $config->get(
'MiserMode' )
332 ||
$context->
msg(
'rc-change-size' )->plain() ===
'$1';
335 $formattedSize =
$lang->formatNum( $szdiff );
337 if ( !$fastCharDiff[
$code] ) {
338 $formattedSize =
$context->
msg(
'rc-change-size', $formattedSize )->text();
341 if ( abs( $szdiff ) > abs( $config->get(
'RCChangedSizeThreshold' ) ) ) {
347 if ( $szdiff === 0 ) {
348 $formattedSizeClass =
'mw-plusminus-null';
349 } elseif ( $szdiff > 0 ) {
350 $formattedSize =
'+' . $formattedSize;
351 $formattedSizeClass =
'mw-plusminus-pos';
353 $formattedSizeClass =
'mw-plusminus-neg';
355 $formattedSizeClass .=
' mw-diff-bytes';
357 $formattedTotalSize =
$context->
msg(
'rc-change-size-new' )->numParams( $new )->text();
359 return Html::element( $tag,
360 [
'dir' =>
'ltr',
'class' => $formattedSizeClass,
'title' => $formattedTotalSize ],
361 $formattedSize ) .
$lang->getDirMark();
372 $oldlen = $old->mAttribs[
'rc_old_len'];
375 $newlen = $new->mAttribs[
'rc_new_len'];
377 $newlen = $old->mAttribs[
'rc_new_len'];
380 if ( $oldlen ===
null || $newlen ===
null ) {
392 $out = $this->rclistOpen ?
"</ul>\n" :
'';
410 $ts =
$rev->getTimestamp();
413 $link = MediaWikiServices::getInstance()->getLinkRenderer()->makeKnownLink(
416 [
'class' =>
'mw-changeslist-date' ],
417 [
'oldid' =>
$rev->getId() ]
420 $link = htmlspecialchars( $date );
423 $link =
"<span class=\"history-deleted mw-changeslist-date\">$link</span>";
433 # Make date header if necessary
435 if ( $date != $this->lastdate ) {
436 if ( $this->lastdate !=
'' ) {
439 $s .= Xml::element(
'h4',
null, $date ) .
"\n<ul class=\"special\">";
440 $this->lastdate = $date;
441 $this->rclistOpen =
true;
451 $page =
new LogPage( $logtype );
452 $logname = $page->getName()->setContext( $this->
getContext() )->text();
453 $s .= $this->
msg(
'parentheses' )->rawParams(
454 $this->linkRenderer->makeKnownLink(
$title, $logname )
466 $rc->mAttribs[
'rc_type'] ==
RC_NEW ||
467 $rc->mAttribs[
'rc_type'] ==
RC_LOG ||
470 $diffLink = $this->
message[
'diff'];
472 $diffLink = $this->
message[
'diff'];
475 'curid' => $rc->mAttribs[
'rc_cur_id'],
476 'diff' => $rc->mAttribs[
'rc_this_oldid'],
477 'oldid' => $rc->mAttribs[
'rc_last_oldid']
480 $diffLink = $this->linkRenderer->makeKnownLink(
483 [
'class' =>
'mw-changeslist-diff' ],
488 $histLink = $this->
message[
'hist'];
490 $histLink = $this->linkRenderer->makeKnownLink(
493 [
'class' =>
'mw-changeslist-history' ],
495 'curid' => $rc->mAttribs[
'rc_cur_id'],
496 'action' =>
'history'
501 $s .= Html::rawElement(
'div', [
'class' =>
'mw-changeslist-links' ],
502 Html::rawElement(
'span', [], $diffLink ) .
503 Html::rawElement(
'span', [], $histLink )
505 ' <span class="mw-changeslist-separator"></span> ';
517 if ( $rc->getTitle()->isRedirect() ) {
518 $params = [
'redirect' =>
'no' ];
521 $articlelink = $this->linkRenderer->makeLink(
524 [
'class' =>
'mw-changeslist-title' ],
528 $articlelink =
'<span class="history-deleted">' . $articlelink .
'</span>';
530 # To allow for boldening pages watched by this user
531 $articlelink =
"<span class=\"mw-title\">{$articlelink}</span>";
533 $articlelink .= $this->
getLanguage()->getDirMark();
535 # TODO: Deprecate the $s argument, it seems happily unused.
537 # Avoid PHP 7.1 warning from passing $this by reference
539 Hooks::run(
'ChangesListInsertArticleLink',
540 [ &
$changesList, &$articlelink, &
$s, &$rc, $unpatrolled, $watched ] );
542 return "{$s} {$articlelink}";
555 return $this->
message[
'semicolon-separator'] .
'<span class="mw-changeslist-date">' .
557 $rc->mAttribs[
'rc_timestamp'],
559 ) ) .
'</span> <span class="mw-changeslist-separator"></span> ';
580 $s .=
' <span class="history-deleted">' .
581 $this->
msg(
'rev-deleted-user' )->escaped() .
'</span>';
584 $rc->mAttribs[
'rc_user_text'] );
586 $rc->mAttribs[
'rc_user'], $rc->mAttribs[
'rc_user_text'],
603 $formatter->setContext( $this->
getContext() );
604 $formatter->setShowUserToolLinks(
true );
607 return $formatter->getActionText() .
" $mark" . $formatter->getComment();
617 return ' <span class="history-deleted">' .
618 $this->
msg(
'rev-deleted-comment' )->escaped() .
'</span>';
640 return $this->watchMsgCache->getWithSetCallback(
641 "watching-users-msg:$count",
642 function ()
use ( $count ) {
643 return $this->
msg(
'number_of_watching_users_RCview' )
644 ->numParams( $count )->escaped();
656 return ( $rc->mAttribs[
'rc_deleted'] & $field ) == $field;
667 public static function userCan( $rc, $field,
User $user =
null ) {
668 if ( $rc->mAttribs[
'rc_type'] ==
RC_LOG ) {
682 return '<strong class="mw-watched">' .
$link .
'</strong>';
684 return '<span class="mw-rc-unwatched">' .
$link .
'</span>';
695 if ( $rc->mAttribs[
'rc_type'] ==
RC_EDIT
696 && $rc->mAttribs[
'rc_this_oldid']
697 && $rc->mAttribs[
'rc_cur_id']
698 && $rc->getAttribute(
'page_latest' ) == $rc->mAttribs[
'rc_this_oldid']
703 if (
$title->quickUserCan(
'rollback', $this->getUser() ) ) {
706 'id' => $rc->mAttribs[
'rc_this_oldid'],
707 'user' => $rc->mAttribs[
'rc_user'],
708 'user_text' => $rc->mAttribs[
'rc_user_text'],
709 'actor' => $rc->mAttribs[
'rc_actor'] ??
null,
710 'deleted' => $rc->mAttribs[
'rc_deleted']
734 if ( empty( $rc->mAttribs[
'ts_tags'] ) ) {
739 $rc->mAttribs[
'ts_tags'],
743 $classes = array_merge( $classes, $newClasses );
744 $s .=
' ' . $tagSummary;
774 $isPatrolled = $rc->mAttribs[
'rc_patrolled'];
775 $rcType = $rc->mAttribs[
'rc_type'];
776 $rcLogType = $rc->mAttribs[
'rc_log_type'];
778 $isPatrolled = $rc->rc_patrolled;
779 $rcType = $rc->rc_type;
780 $rcLogType = $rc->rc_log_type;
783 if ( !$isPatrolled ) {
784 if (
$user->useRCPatrol() ) {
790 if (
$user->useFilePatrol() && $rcLogType ==
'upload' ) {
808 return intval( $rcObj->getAttribute(
'rc_type' ) ) ===
RC_CATEGORIZE
809 && intval( $rcObj->getAttribute(
'rc_this_oldid' ) ) === 0;
822 case RecentChange::SRC_EDIT:
823 case RecentChange::SRC_NEW:
824 $attrs[
'data-mw-revid'] = $rc->mAttribs[
'rc_this_oldid'];
826 case RecentChange::SRC_LOG:
827 $attrs[
'data-mw-logid'] = $rc->mAttribs[
'rc_logid'];
828 $attrs[
'data-mw-logaction'] =
829 $rc->mAttribs[
'rc_log_type'] .
'/' . $rc->mAttribs[
'rc_log_action'];
833 $attrs[
'data-mw-ts' ] = $rc->
getAttribute(
'rc_timestamp' );
846 $this->changeLinePrefixer = $prefixer;
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
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
$wgRecentChangesFlags
Flags (letter symbols) shown in recent changes and watchlist to indicate certain types of edits.
static newFromContext(IContextSource $context, array $groups=[])
Fetch an appropriate changes list class for the specified context Some users might want to use an enh...
maybeWatchedLink( $link, $watched=false)
static userCan( $rc, $field, User $user=null)
Determine if the current user is allowed to view a particular field of this revision,...
setWatchlistDivs( $value=true)
Sets the list to use a "<li class='watchlist-(namespace)-(page)'>" tag.
formatCharacterDifference(RecentChange $old, RecentChange $new=null)
Format the character difference of one or several changes.
insertDateHeader(&$s, $rc_timestamp)
insertRollback(&$s, &$rc)
Insert a rollback link.
showAsUnpatrolled(RecentChange $rc)
static isUnpatrolled( $rc, User $user)
getHighlightsContainerDiv()
Get the container for highlights that are used in the new StructuredFilters system.
recentChangesLine(&$rc, $watched=false, $linenumber=null)
Format a line.
recentChangesFlags( $flags, $nothing="\u{00A0}")
Returns the appropriate flags for new page, minor change and patrolling.
getDataAttributes(RecentChange $rc)
Get recommended data attributes for a change line.
numberofWatchingusers( $count)
Returns the string which indicates the number of watching users.
getHTMLClasses( $rc, $watched)
Get an array of default HTML class attributes for the change.
insertLog(&$s, $title, $logtype)
callable $changeLinePrefixer
getTags(RecentChange $rc, array &$classes)
getArticleLink(&$rc, $unpatrolled, $watched)
insertUserRelatedLinks(&$s, &$rc)
Insert links to user page, user talk page and eventually a blocking link.
static showCharacterDifference( $old, $new, IContextSource $context=null)
Show formatted char difference.
getRollback(RecentChange $rc)
MapCacheLRU $watchMsgCache
endRecentChangesList()
Returns text for the end of RC.
static flag( $flag, IContextSource $context=null)
Make an "<abbr>" element for a given change flag.
LinkRenderer $linkRenderer
preCacheMessages()
As we use the same small set of messages in various methods and that they are called often,...
insertLogEntry( $rc)
Insert a formatted action.
setChangeLinePrefixer(callable $prefixer)
Sets the callable that generates a change line prefix added to the beginning of each line.
static isDeleted( $rc, $field)
Determine if said field of a revision is hidden.
static revDateLink(Revision $rev, User $user, Language $lang, $title=null)
Render the date and time of a revision in the current user language based on whether the user is able...
insertTags(&$s, &$rc, &$classes)
insertComment( $rc)
Insert a formatted comment.
insertExtra(&$s, &$rc, &$classes)
__construct( $obj, array $filterGroups=[])
initChangesListRows( $rows)
getTimestamp( $rc)
Get the timestamp from $rc formatted with current user's settings and a separator.
isCategorizationWithoutRevision( $rcObj)
Determines whether a revision is linked to this change; this may not be the case when the categorizat...
getHTMLClassesForFilters( $rc)
Get an array of CSS classes attributed to filters for this row.
insertDiffHist(&$s, &$rc, $unpatrolled=null)
insertTimestamp(&$s, $rc)
Insert time timestamp string from $rc into $s.
beginRecentChangesList()
Returns text for the start of the tabular part of RC.
The simplest way of implementing IContextSource is to hold a RequestContext as a member variable and ...
msg( $key)
Get a Message object with context set Parameters are the same as wfMessage()
getContext()
Get the base IContextSource object.
setContext(IContextSource $context)
Marks HTML that shouldn't be escaped.
Internationalisation code.
static generateRollback( $rev, IContextSource $context=null, $options=[ 'verify'])
Generate a rollback link for a given revision.
static userLink( $userId, $userName, $altUserName=false)
Make user link (or user contributions for unregistered users)
static commentBlock( $comment, $title=null, $local=false, $wikiId=null, $useParentheses=true)
Wrap a comment in standard punctuation and formatting if it's non-empty, otherwise return empty strin...
static userToolLinks( $userId, $userText, $redContribsWhenNoEdits=false, $flags=0, $edits=null, $useParentheses=true)
Generate standard user tool links (talk, contributions, block link, etc.)
static userCanBitfield( $bitfield, $field, User $user=null)
Determine if the current user is allowed to view a particular field of this log row,...
Class to simplify the use of log pages.
Handles a simple LRU key/value map with a maximum number of entries.
Utility class for creating new RC entries.
getAttribute( $name)
Get an attribute value.
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,...
The main skin class which provides methods and properties for all other skins.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
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
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
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
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not it can be in the form of< username >< more info > e g for bot passwords intended to be added to log contexts Fields it might only if the login was with a bot password 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
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
namespace and then decline to actually register it file or subcat img or subcat $title
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not it can be in the form of< username >< more info > e g for bot passwords intended to be added to log contexts Fields it might only if the login was with a bot password 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
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 "<div ...>$1</div>"). - flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException':Called before an exception(or PHP error) is logged. This is meant for integration with external error aggregation services
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
usually copyright or history_copyright This message must be in HTML not wikitext & $link
null for the local 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
return true to allow those checks to and false if checking is done & $user
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
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
Interface for objects which can provide a MediaWiki context on request.
getConfig()
Get the site configuration.
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))
if(!isset( $args[0])) $lang