63 $this->watchMsgCache =
new HashBagOStuff( [
'maxKeys' => 50 ] );
64 $this->linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
79 $new = $context->
getRequest()->getBool(
'enhanced',
$user->getOption(
'usenewrc' ) );
107 $this->watchlist =
$value;
123 if ( !isset( $this->
message ) ) {
125 'cur',
'diff',
'hist',
'enhancedrc-history',
'last',
'blocklink',
'history',
126 'semicolon-separator',
'pipe-separator' ]
as $msg
128 $this->
message[$msg] = $this->
msg( $msg )->escaped();
141 foreach ( array_keys( $this->
getConfig()->
get(
'RecentChangesFlags' ) )
as $flag ) {
160 $logType = $rc->mAttribs[
'rc_log_type'];
166 $rc->mAttribs[
'rc_namespace'] .
'-' . $rc->mAttribs[
'rc_title'] );
171 $classes[] = $watched && $rc->mAttribs[
'rc_timestamp'] >= $watched
172 ?
'mw-changeslist-line-watched'
173 :
'mw-changeslist-line-not-watched';
187 static $map = [
'minoredit' =>
'minor',
'botedit' =>
'bot' ];
188 static $flagInfos = null;
190 if ( is_null( $flagInfos ) ) {
191 global $wgRecentChangesFlags;
193 foreach ( $wgRecentChangesFlags
as $key =>
$value ) {
194 $flagInfos[$key][
'letter'] =
$value[
'letter'];
195 $flagInfos[$key][
'title'] =
$value[
'title'];
197 $flagInfos[$key][
'class'] = isset(
$value[
'class'] ) ?
$value[
'class'] : $key;
204 if ( isset( $map[$flag] ) ) {
208 $info = $flagInfos[$flag];
210 'class' => $info[
'class'],
220 $this->rc_cache = [];
221 $this->rcMoveIndex = 0;
222 $this->rcCacheIndex = 0;
223 $this->lastdate =
'';
224 $this->rclistOpen =
false;
225 $this->
getOutput()->addModuleStyles(
'mediawiki.special.changeslist' );
227 return '<div class="mw-changeslist">';
234 Hooks::run(
'ChangesListInitRows', [ $this, $rows ] );
254 $szdiff = $new - $old;
259 static $fastCharDiff = [];
260 if ( !isset( $fastCharDiff[
$code] ) ) {
261 $fastCharDiff[
$code] = $config->get(
'MiserMode' )
262 ||
$context->
msg(
'rc-change-size' )->plain() ===
'$1';
265 $formattedSize =
$lang->formatNum( $szdiff );
267 if ( !$fastCharDiff[$code] ) {
268 $formattedSize =
$context->
msg(
'rc-change-size', $formattedSize )->text();
271 if ( abs( $szdiff ) > abs( $config->get(
'RCChangedSizeThreshold' ) ) ) {
277 if ( $szdiff === 0 ) {
278 $formattedSizeClass =
'mw-plusminus-null';
279 } elseif ( $szdiff > 0 ) {
280 $formattedSize =
'+' . $formattedSize;
281 $formattedSizeClass =
'mw-plusminus-pos';
283 $formattedSizeClass =
'mw-plusminus-neg';
286 $formattedTotalSize =
$context->
msg(
'rc-change-size-new' )->numParams( $new )->text();
289 [
'dir' =>
'ltr',
'class' => $formattedSizeClass,
'title' => $formattedTotalSize ],
290 $context->
msg(
'parentheses', $formattedSize )->plain() ) .
$lang->getDirMark();
301 $oldlen = $old->mAttribs[
'rc_old_len'];
304 $newlen = $new->mAttribs[
'rc_new_len'];
306 $newlen = $old->mAttribs[
'rc_new_len'];
309 if ( $oldlen === null || $newlen === null ) {
313 return self::showCharacterDifference( $oldlen, $newlen, $this->
getContext() );
321 $out = $this->rclistOpen ?
"</ul>\n" :
'';
332 # Make date header if necessary
334 if ( $date != $this->lastdate ) {
335 if ( $this->lastdate !=
'' ) {
338 $s .=
Xml::element(
'h4', null, $date ) .
"\n<ul class=\"special\">";
339 $this->lastdate = $date;
340 $this->rclistOpen =
true;
351 $logname =
$page->getName()->setContext( $this->
getContext() )->text();
352 $s .= $this->
msg(
'parentheses' )->rawParams(
353 $this->linkRenderer->makeKnownLink(
$title, $logname )
365 $rc->mAttribs[
'rc_type'] ==
RC_NEW ||
366 $rc->mAttribs[
'rc_type'] ==
RC_LOG ||
369 $diffLink = $this->
message[
'diff'];
371 $diffLink = $this->
message[
'diff'];
374 'curid' => $rc->mAttribs[
'rc_cur_id'],
375 'diff' => $rc->mAttribs[
'rc_this_oldid'],
376 'oldid' => $rc->mAttribs[
'rc_last_oldid']
379 $diffLink = $this->linkRenderer->makeKnownLink(
387 $diffhist = $diffLink . $this->
message[
'pipe-separator'] . $this->
message[
'hist'];
389 $diffhist = $diffLink . $this->
message[
'pipe-separator'];
391 $diffhist .= $this->linkRenderer->makeKnownLink(
396 'curid' => $rc->mAttribs[
'rc_cur_id'],
397 'action' =>
'history'
403 $s .= $this->
msg(
'parentheses' )->rawParams( $diffhist )->escaped() .
404 ' <span class="mw-changeslist-separator">. .</span> ';
427 if ( $rc->getTitle()->isRedirect() ) {
428 $params = [
'redirect' =>
'no' ];
431 $articlelink = $this->linkRenderer->makeLink(
434 [
'class' =>
'mw-changeslist-title' ],
438 $articlelink =
'<span class="history-deleted">' . $articlelink .
'</span>';
440 # To allow for boldening pages watched by this user
441 $articlelink =
"<span class=\"mw-title\">{$articlelink}</span>";
443 $articlelink .= $this->
getLanguage()->getDirMark();
445 # TODO: Deprecate the $s argument, it seems happily unused.
448 [ &$this, &$articlelink, &
$s, &$rc, $unpatrolled, $watched ] );
450 return "{$s} {$articlelink}";
462 return $this->
message[
'semicolon-separator'] .
'<span class="mw-changeslist-date">' .
464 $rc->mAttribs[
'rc_timestamp'],
466 ) .
'</span> <span class="mw-changeslist-separator">. .</span> ';
487 $s .=
' <span class="history-deleted">' .
488 $this->
msg(
'rev-deleted-user' )->escaped() .
'</span>';
491 $rc->mAttribs[
'rc_user_text'] );
504 $formatter->setContext( $this->
getContext() );
505 $formatter->setShowUserToolLinks(
true );
508 return $formatter->getActionText() .
" $mark" . $formatter->getComment();
518 return ' <span class="history-deleted">' .
519 $this->
msg(
'rev-deleted-comment' )->escaped() .
'</span>';
535 return $cache->getWithSetCallback(
$count, $cache::TTL_INDEFINITE,
537 return $this->
msg(
'number_of_watching_users_RCview' )
538 ->numParams(
$count )->escaped();
550 return ( $rc->mAttribs[
'rc_deleted'] & $field ) == $field;
562 if ( $rc->mAttribs[
'rc_type'] ==
RC_LOG ) {
576 return '<strong class="mw-watched">' .
$link .
'</strong>';
578 return '<span class="mw-rc-unwatched">' .
$link .
'</span>';
588 if ( $rc->mAttribs[
'rc_type'] ==
RC_EDIT
589 && $rc->mAttribs[
'rc_this_oldid']
590 && $rc->mAttribs[
'rc_cur_id']
592 $page = $rc->getTitle();
595 if ( $this->
getUser()->isAllowed(
'rollback' )
596 && $rc->mAttribs[
'page_latest'] == $rc->mAttribs[
'rc_this_oldid']
600 'id' => $rc->mAttribs[
'rc_this_oldid'],
601 'user' => $rc->mAttribs[
'rc_user'],
602 'user_text' => $rc->mAttribs[
'rc_user_text'],
603 'deleted' => $rc->mAttribs[
'rc_deleted']
627 if ( empty( $rc->mAttribs[
'ts_tags'] ) ) {
632 $rc->mAttribs[
'ts_tags'],
636 $classes = array_merge( $classes, $newClasses );
637 $s .=
' ' . $tagSummary;
657 return self::isUnpatrolled( $rc, $this->
getUser() );
667 $isPatrolled = $rc->mAttribs[
'rc_patrolled'];
668 $rcType = $rc->mAttribs[
'rc_type'];
669 $rcLogType = $rc->mAttribs[
'rc_log_type'];
671 $isPatrolled = $rc->rc_patrolled;
672 $rcType = $rc->rc_type;
673 $rcLogType = $rc->rc_log_type;
676 if ( !$isPatrolled ) {
701 return intval( $rcObj->getAttribute(
'rc_type' ) ) ===
RC_CATEGORIZE
702 && intval( $rcObj->getAttribute(
'rc_this_oldid' ) ) === 0;
static newFromContext(IContextSource $context)
Fetch an appropriate changes list class for the specified context Some users might want to use an enh...
setContext(IContextSource $context)
Set the IContextSource object.
Utility class for creating new RC entries.
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
Interface for objects which can provide a MediaWiki context on request.
insertLog(&$s, $title, $logtype)
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
static userCan($rc, $field, User $user=null)
Determine if the current user is allowed to view a particular field of this revision, if it's marked as deleted.
the array() calling protocol came about after MediaWiki 1.4rc1.
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
getLanguage()
Get the Language object.
endRecentChangesList()
Returns text for the end of RC.
static element($element, $attribs=null, $contents= '', $allowShortTag=true)
Format an XML element with given attributes and, optionally, text content.
insertExtra(&$s, &$rc, &$classes)
insertRollback(&$s, &$rc)
Inserts a rollback link.
recentChangesFlags($flags, $nothing= ' ')
Returns the appropriate flags for new page, minor change and patrolling.
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
static isDeleted($rc, $field)
Determine if said field of a revision is hidden.
initChangesListRows($rows)
The simplest way of implementing IContextSource is to hold a RequestContext as a member variable and ...
msg()
Get a Message object with context set.
if(!isset($args[0])) $lang
getTags(RecentChange $rc, array &$classes)
numberofWatchingusers($count)
Returns the string which indicates the number of watching users.
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
it s the revision text itself In either if gzip is the revision text is gzipped $flags
formatCharacterDifference(RecentChange $old, RecentChange $new=null)
Format the character difference of one or several changes.
static escapeClass($class)
Given a value, escape it so that it can be used as a CSS class and return it.
when a variable name is used in a it is silently declared as a new local masking the global
__construct($obj)
Changeslist constructor.
insertDateHeader(&$s, $rc_timestamp)
Class to simplify the use of log pages.
usually copyright or history_copyright This message must be in HTML not wikitext & $link
getUser()
Get the User object.
msg()
Get a Message object with context set Parameters are the same as wfMessage()
getConfig()
Get the site configuration.
insertUserRelatedLinks(&$s, &$rc)
Insert links to user page, user talk page and eventually a blocking link.
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 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
static getMain()
Static methods.
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 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 unsetoffset-wrap String Wrap the message in html(usually something like"<
getConfig()
Get the Config object.
getRollback(RecentChange $rc)
getArticleLink(&$rc, $unpatrolled, $watched)
static showCharacterDifference($old, $new, IContextSource $context=null)
Show formatted char difference.
showAsUnpatrolled(RecentChange $rc)
getContext()
Get the base IContextSource object.
getTimestamp($rc)
Get the timestamp from $rc formatted with current user's settings and a separator.
namespace and then decline to actually register it file or subcat img or subcat $title
isCategorizationWithoutRevision($rcObj)
Determines whether a revision is linked to this change; this may not be the case when the categorizat...
static run($event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add text
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books $tag
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
getLanguage()
Get the Language object.
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
insertTimestamp(&$s, $rc)
Insert time timestamp string from $rc into $s.
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
insertTags(&$s, &$rc, &$classes)
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 local account $user
useRCPatrol()
Check whether to enable recent changes patrol features for this user.
preCacheMessages()
As we use the same small set of messages in various methods and that they are called often...
insertArticleLink(&$s, RecentChange $rc, $unpatrolled, $watched)
static userLink($userId, $userName, $altUserName=false)
Make user link (or user contributions for unregistered users)
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
beginRecentChangesList()
Returns text for the start of the tabular part of RC.
useFilePatrol()
Check whether to enable new files patrol features for this user.
getSkin()
Get the Skin object.
static generateRollback($rev, IContextSource $context=null, $options=[ 'verify'])
Generate a rollback link for a given revision.
static userCanBitfield($bitfield, $field, User $user=null)
Determine if the current user is allowed to view a particular field of this log row, if it's marked as deleted.
static userToolLinks($userId, $userText, $redContribsWhenNoEdits=false, $flags=0, $edits=null)
Generate standard user tool links (talk, contributions, block link, etc.)
useNPPatrol()
Check whether to enable new pages patrol features for this user.
static flag($flag, IContextSource $context=null)
Make an "
" element for a given change flag.
insertLogEntry($rc)
Insert a formatted action.
LinkRenderer $linkRenderer
setWatchlistDivs($value=true)
Sets the list to use a "
" tag.
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, if it's marked as deleted.
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...
static isUnpatrolled($rc, User $user)
insertComment($rc)
Insert a formatted comment.
recentChangesLine(&$rc, $watched=false, $linenumber=null)
Format a line.
getHTMLClasses($rc, $watched)
Get an array of default HTML class attributes for the change.
insertDiffHist(&$s, &$rc, $unpatrolled=null)
static element($element, $attribs=[], $contents= '')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
getUser()
Get the User object.
getRequest()
Get the WebRequest object.
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a skin(according to that user's preference)
maybeWatchedLink($link, $watched=false)
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached $page
getOutput()
Get the OutputPage object.
getSkin()
Get the Skin object.