34 parent::__construct(
$name, $restriction );
45 $feedFormat = $this->
getRequest()->getVal(
'feed' );
46 if ( !$this->
including() && $feedFormat ) {
48 $query[
'feedformat'] = $feedFormat ===
'atom' ?
'atom' :
'rss';
58 if ( $lastmod ===
false ) {
63 '//meta.wikimedia.org/wiki/Special:MyLanguage/Help:Recent_changes',
75 $opts = parent::getDefaultOptions();
78 $opts->add(
'days',
$user->getIntOption(
'rcdays' ) );
79 $opts->add(
'limit',
$user->getIntOption(
'rclimit' ) );
80 $opts->add(
'from',
'' );
82 $opts->add(
'hideminor',
$user->getBoolOption(
'hideminor' ) );
83 $opts->add(
'hidebots',
true );
84 $opts->add(
'hideanons',
false );
85 $opts->add(
'hideliu',
false );
86 $opts->add(
'hidepatrolled',
$user->getBoolOption(
'hidepatrolled' ) );
87 $opts->add(
'hidemyself',
false );
88 $opts->add(
'hidecategorization',
$user->getBoolOption(
'hidecategorization' ) );
90 $opts->add(
'categories',
'' );
91 $opts->add(
'categories_any',
false );
92 $opts->add(
'tagfilter',
'' );
103 if ( $this->customFilters === null ) {
104 $this->customFilters = parent::getCustomFilters();
105 Hooks::run(
'SpecialRecentChangesFilters', [ $this, &$this->customFilters ],
'1.23' );
118 $bits = preg_split(
'/\s*,\s*/', trim( $par ) );
119 foreach ( $bits
as $bit ) {
120 if (
'hidebots' === $bit ) {
121 $opts[
'hidebots'] =
true;
123 if (
'bots' === $bit ) {
124 $opts[
'hidebots'] =
false;
126 if (
'hideminor' === $bit ) {
127 $opts[
'hideminor'] =
true;
129 if (
'minor' === $bit ) {
130 $opts[
'hideminor'] =
false;
132 if (
'hideliu' === $bit ) {
133 $opts[
'hideliu'] =
true;
135 if (
'hidepatrolled' === $bit ) {
136 $opts[
'hidepatrolled'] =
true;
138 if (
'hideanons' === $bit ) {
139 $opts[
'hideanons'] =
true;
141 if (
'hidemyself' === $bit ) {
142 $opts[
'hidemyself'] =
true;
144 if (
'hidecategorization' === $bit ) {
145 $opts[
'hidecategorization'] =
true;
148 if ( is_numeric( $bit ) ) {
149 $opts[
'limit'] = $bit;
153 if ( preg_match(
'/^limit=(\d+)$/', $bit, $m ) ) {
154 $opts[
'limit'] = $m[1];
156 if ( preg_match(
'/^days=(\d+)$/', $bit, $m ) ) {
157 $opts[
'days'] = $m[1];
159 if ( preg_match(
'/^namespace=(\d+)$/', $bit, $m ) ) {
160 $opts[
'namespace'] = $m[1];
162 if ( preg_match(
'/^tagfilter=(.*)$/', $bit, $m ) ) {
163 $opts[
'tagfilter'] = $m[1];
170 parent::validateOptions( $opts );
181 $conds = parent::buildMainQueryConds( $opts );
184 $cutoff_unixtime = time() - ( $opts[
'days'] * 86400 );
185 $cutoff_unixtime = $cutoff_unixtime - ( $cutoff_unixtime % 86400 );
186 $cutoff =
$dbr->timestamp( $cutoff_unixtime );
188 $fromValid = preg_match(
'/^[0-9]{14}$/', $opts[
'from'] );
190 $cutoff =
$dbr->timestamp( $opts[
'from'] );
192 $opts->
reset(
'from' );
195 $conds[] =
'rc_timestamp >= ' .
$dbr->addQuotes( $cutoff );
217 if (
$user->getId() &&
$user->isAllowed(
'viewmywatchlist' ) ) {
219 $fields[] =
'wl_user';
220 $fields[] =
'wl_notificationtimestamp';
221 $join_conds[
'watchlist'] = [
'LEFT JOIN', [
222 'wl_user' =>
$user->getId(),
224 'wl_namespace=rc_namespace'
228 if (
$user->isAllowed(
'rollback' ) ) {
230 $fields[] =
'page_latest';
231 $join_conds[
'page'] = [
'LEFT JOIN',
'rc_cur_id=page_id' ];
253 $query_options = array_merge( [
254 'ORDER BY' =>
'rc_timestamp DESC',
255 'LIMIT' => $opts[
'limit'] ], $query_options );
256 $rows =
$dbr->select(
261 $conds + [
'rc_new' => [ 0, 1 ] ],
268 if ( $this->
getConfig()->
get(
'AllowCategorizedRecentChanges' ) ) {
276 &$query_options, &$join_conds, $opts
278 return parent::runMainQueryHook(
$tables, $fields, $conds, $query_options, $join_conds, $opts )
280 'SpecialRecentChangesQuery',
281 [ &$conds, &
$tables, &$join_conds, $opts, &$query_options, &$fields ],
304 $query[
'action'] =
'feedrecentchanges';
305 $feedLimit = $this->
getConfig()->get(
'FeedLimit' );
306 if ( $query[
'limit'] > $feedLimit ) {
307 $query[
'limit'] = $feedLimit;
322 $showWatcherCount = $this->
getConfig()->get(
'RCShowWatchingUsers' )
323 && $this->
getUser()->getOption(
'shownumberswatching' );
330 $list->initChangesListRows( $rows );
332 $userShowHiddenCats = $this->
getUser()->getBoolOption(
'showhiddencats' );
333 $rclistOutput = $list->beginRecentChangesList();
334 foreach ( $rows
as $obj ) {
340 # Skip CatWatch entries for hidden cats based on user preference
343 !$userShowHiddenCats &&
344 $rc->getParam(
'hidden-cat' )
349 $rc->counter = $counter++;
350 # Check if the page has been updated since the last visit
351 if ( $this->
getConfig()->get(
'ShowUpdatedMarker' )
352 && !empty( $obj->wl_notificationtimestamp )
354 $rc->notificationtimestamp = ( $obj->rc_timestamp >= $obj->wl_notificationtimestamp );
356 $rc->notificationtimestamp =
false;
358 # Check the number of users watching the page
359 $rc->numberofWatchingusers = 0;
360 if ( $showWatcherCount && $obj->rc_namespace >= 0 ) {
361 if ( !isset( $watcherCache[$obj->rc_namespace][$obj->rc_title] ) ) {
362 $watcherCache[$obj->rc_namespace][$obj->rc_title] =
363 MediaWikiServices::getInstance()->getWatchedItemStore()->countWatchers(
364 new TitleValue( (
int)$obj->rc_namespace, $obj->rc_title )
367 $rc->numberofWatchingusers = $watcherCache[$obj->rc_namespace][$obj->rc_title];
370 $changeLine = $list->recentChangesLine( $rc, !empty( $obj->wl_user ), $counter );
371 if ( $changeLine !==
false ) {
372 $rclistOutput .= $changeLine;
376 $rclistOutput .= $list->endRecentChangesList();
378 if ( $rows->numRows() === 0 ) {
380 '<div class="mw-changeslist-empty">' .
381 $this->
msg(
'recentchanges-noresult' )->parse() .
385 $this->
getOutput()->setStatusCode( 404 );
388 $this->
getOutput()->addHTML( $rclistOutput );
401 $defaults = $opts->getAllValues();
402 $nondefaults = $opts->getChangedValues();
406 $panel[] = $this->
optionsPanel( $defaults, $nondefaults, $numRows );
410 $extraOptsCount = count( $extraOpts );
415 foreach ( $extraOpts
as $name => $optionRow ) {
416 # Add submit button to the last row only
418 $addSubmit = (
$count === $extraOptsCount ) ? $submit :
'';
421 if ( is_array( $optionRow ) ) {
424 [
'class' =>
'mw-label mw-' .
$name .
'-label' ],
429 [
'class' =>
'mw-input' ],
430 $optionRow[1] . $addSubmit
435 [
'class' =>
'mw-input',
'colspan' => 2 ],
436 $optionRow . $addSubmit
443 $unconsumed = $opts->getUnconsumedValues();
444 foreach ( $unconsumed
as $key =>
$value ) {
452 $panelString = implode(
"\n", $panel );
456 $this->
msg(
'recentchanges-legend' )->
text(),
458 [
'class' =>
'rcoptions' ]
473 $message = $this->
msg(
'recentchangestext' )->inContentLanguage();
474 if ( !$message->isDisabled() ) {
477 [
'lang' => $wgContLang->getHtmlCode(),
'dir' => $wgContLang->getDir() ],
478 "\n" . $message->plain() .
"\n"
493 $opts->consumeValues( [
494 'namespace',
'invert',
'associated',
'tagfilter',
'categories',
'categories_any'
500 if ( $this->
getConfig()->
get(
'AllowCategorizedRecentChanges' ) ) {
505 if ( count( $tagFilter ) ) {
506 $extraOpts[
'tagfilter'] = $tagFilter;
510 if ( $this->
getName() ===
'Recentchanges' ) {
511 Hooks::run(
'SpecialRecentChangesPanel', [ &$extraOpts, $opts ] );
521 parent::addModules();
523 $out->addModules(
'mediawiki.special.recentchanges' );
535 $lastmod =
$dbr->selectField(
'recentchanges',
'MAX(rc_timestamp)',
false, __METHOD__ );
548 [
'selected' => $opts[
'namespace'],
'all' =>
'' ],
549 [
'name' =>
'namespace',
'id' =>
'namespace' ]
553 $this->
msg(
'invert' )->
text(),
'invert',
'nsinvert',
555 [
'title' => $this->
msg(
'tooltip-invert' )->
text() ]
558 $this->
msg(
'namespace_association' )->
text(),
'associated',
'nsassociated',
560 [
'title' => $this->
msg(
'tooltip-namespace_association' )->
text() ]
563 return [ $nsLabel,
"$nsSelect $invert $associated" ];
574 'categories',
'mw-categories',
false, $opts[
'categories'] );
577 'categories_any',
'mw-categories_any', $opts[
'categories_any'] );
579 return [ $label, $input ];
589 $categories = array_map(
'trim', explode(
'|', $opts[
'categories'] ) );
591 if ( !count( $categories ) ) {
597 foreach ( $categories
as $cat ) {
609 foreach ( $rows
as $k => $r ) {
611 $id = $nt->getArticleID();
613 continue; #
Page might have been deleted...
615 if ( !in_array( $id, $articles ) ) {
618 if ( !isset( $a2r[$id] ) ) {
626 if ( !count( $articles ) || !count( $cats ) ) {
632 $catFind->
seed( $articles, $cats, $opts[
'categories_any'] ?
'OR' :
'AND' );
633 $match = $catFind->run();
637 foreach ( $match
as $id ) {
638 foreach ( $a2r[$id]
as $rev ) {
640 $newrows[$k] = $rowsarr[$k];
661 if ( $value ===
false ) {
667 $text = htmlspecialchars(
$title );
669 $text =
'<strong>' . $text .
'</strong>';
684 $options = $nondefaults + $defaults;
687 $msg = $this->
msg(
'rclegend' );
688 if ( !$msg->isDisabled() ) {
689 $note .=
'<div class="mw-rclegend">' . $msg->parse() .
"</div>\n";
696 $note .= $this->
msg(
'rcnotefrom' )
703 ->numParams( $numRows )
704 ->parse() .
'<br />';
707 # Sort data for display and make sure it's unique after we've added user data.
708 $linkLimits = $config->get(
'RCLinkLimits' );
711 $linkLimits = array_unique( $linkLimits );
713 $linkDays = $config->get(
'RCLinkDays' );
716 $linkDays = array_unique( $linkDays );
722 [
'limit' =>
$value ], $nondefaults, $value ==
$options[
'limit'] );
724 $cl =
$lang->pipeList( $cl );
728 foreach ( $linkDays
as $value ) {
730 [
'days' =>
$value,
'from' =>
'' ], $nondefaults, $value ==
$options[
'days'] );
732 $dl =
$lang->pipeList( $dl );
736 'hideminor' =>
'rcshowhideminor',
737 'hidebots' =>
'rcshowhidebots',
738 'hideanons' =>
'rcshowhideanons',
739 'hideliu' =>
'rcshowhideliu',
740 'hidepatrolled' =>
'rcshowhidepatr',
741 'hidemyself' =>
'rcshowhidemine'
744 if ( $config->get(
'RCWatchCategoryMembership' ) ) {
745 $filters[
'hidecategorization'] =
'rcshowhidecategorization';
748 $showhide = [
'show',
'hide' ];
751 $filters[$key] =
$params[
'msg'];
754 if ( !
$user->useRCPatrol() ) {
755 unset( $filters[
'hidepatrolled'] );
759 foreach ( $filters
as $key => $msg ) {
765 $linkMessage = $this->
msg( $msg .
'-' . $showhide[1 -
$options[$key]] );
768 if ( !$linkMessage->exists() ) {
769 $linkMessage = $this->
msg( $showhide[1 -
$options[$key]] );
773 [ $key => 1 -
$options[$key] ], $nondefaults );
774 $links[] =
"<span class=\"$msg rcshowhideoption\">"
775 . $this->
msg( $msg )->rawParams(
$link )->escaped() .
'</span>';
783 $pipedLinks =
'<span class="rcshowhide">' .
$lang->pipeList( $links ) .
'</span>';
785 $rclinks =
'<span class="rclinks">' . $this->
msg(
'rclinks' )->rawParams( $cl, $dl, $pipedLinks )
786 ->parse() .
'</span>';
789 $this->
msg(
'rclistfrom' )->rawParams( $now, $timenow, $datenow )->parse(),
794 return "{$note}$rclinks<br />$rclistfrom";
static newFromContext(IContextSource $context)
Fetch an appropriate changes list class for the specified context Some users might want to use an enh...
namespaceFilterForm(FormOptions $opts)
Creates the choose namespace selection.
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
wfGetDB($db, $groups=[], $wiki=false)
Get a Database object.
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
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
getContext()
Gets the context this SpecialPage is executed in.
wfScript($script= 'index')
Get the path to a specified script file, respecting file extensions; this is a wrapper around $wgScri...
getCustomFilters()
Get custom show/hide filters.
doMainQuery($conds, $opts)
Process the query.
The "CategoryFinder" class takes a list of articles, creates an internal representation of all their ...
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
__construct($name= 'Recentchanges', $restriction= '')
setTopText(FormOptions $opts)
Send the text to be displayed above the options.
static rawElement($element, $attribs=[], $contents= '')
Returns an HTML element in a string.
if(!isset($args[0])) $lang
static hidden($name, $value, array $attribs=[])
Convenience function to produce an input element with type=hidden.
addFeedLinks($params)
Adds RSS/atom links.
optionsPanel($defaults, $nondefaults, $numRows)
Creates the options panel.
Represents a page (or page fragment) title within MediaWiki.
A special page that lists last changes made to the wiki.
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
msg()
Wrapper around wfMessage that sets the current context.
buildMainQueryConds(FormOptions $opts)
Return an array of conditions depending of options set in $opts.
including($x=null)
Whether the special page is being evaluated via transclusion.
getOutput()
Get the OutputPage being used for this instance.
when a variable name is used in a it is silently declared as a new local masking the global
getOptions()
Get the current FormOptions for this request.
static submitButton($value, $attribs=[])
Convenience function to build an HTML submit button When $wgUseMediaWikiUIEverywhere is true it will ...
addHelpLink($to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist & $tables
static label($label, $id, $attribs=[])
Convenience function to build an HTML form label.
usually copyright or history_copyright This message must be in HTML not wikitext & $link
validateOptions(FormOptions $opts)
categoryFilterForm(FormOptions $opts)
Create an input to filter changes by categories.
wfTimestamp($outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
static fieldset($legend=false, $content=false, $attribs=[])
Shortcut for creating fieldsets.
static closeElement($element)
Shortcut to close an XML element.
Interface for type hinting (accepts WikiPage, Article, ImagePage, CategoryPage)
getExtraOptions($opts)
Get options to be displayed in a form.
wfAppendQuery($url, $query)
Append a query string to an existing URL, which may or may not already have query string parameters a...
doHeader($opts, $numRows)
Set the text to be displayed above the changes.
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 as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content as context as context $options
static openElement($element, $attribs=null)
This opens an XML element.
wfTimestampNow()
Convenience function; returns MediaWiki timestamp for the present time.
const TS_MW
MediaWiki concatenated string timestamp (YYYYMMDDHHMMSS)
namespace and then decline to actually register it file or subcat img or subcat $title
static linkKnown($target, $html=null, $customAttribs=[], $query=[], $options=[ 'known'])
Identical to link(), except $options defaults to 'known'.
static run($event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
makeOptionsLink($title, $override, $options, $active=false)
Makes change an option link which carries all the other options.
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
setBottomText(FormOptions $opts)
Send the text to be displayed after the options.
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 selectFields()
Return the list of recentchanges fields that should be selected to create a new recentchanges object...
static inputLabelSep($label, $name, $id, $size=false, $value=false, $attribs=[])
Same as Xml::inputLabel() but return input and label in an array.
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
static array static newFromRow($row)
getDefaultOptions()
Get a FormOptions object containing the default options.
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
static tags($element, $attribs=null, $contents)
Same as Xml::element(), but does not escape contents.
getName()
Get the name of this Special Page.
Special page which uses a ChangesList to show query results.
getUser()
Shortcut to get the User executing this instance.
getConfig()
Shortcut to get main config object.
getLanguage()
Shortcut to get user's language.
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 as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content as context as context the output can only depend on parameters provided to this hook not on global state indicating whether full HTML should be generated If generation of HTML may be but other information should still be present in the ParserOutput object to manipulate or replace but no entry for that model exists in $wgContentHandlers if desired whether it is OK to use $contentModel on $title Handler functions that modify $ok should generally return false to prevent further hooks from further modifying $ok inclusive $limit
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 and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the local content language as $wgContLang
seed($articleIds, $categories, $mode= 'AND')
Initializes the instance.
static checkLabel($label, $name, $id, $checked=false, $attribs=[])
Convenience function to build an HTML checkbox with a label.
execute($subpage)
Main execution point.
getRequest()
Get the WebRequest being used for this instance.
getFeedQuery()
Get URL query parameters for action=feedrecentchanges API feed of current recent changes view...
makeLegend()
Return the legend displayed within the fieldset.
runMainQueryHook(&$tables, &$fields, &$conds, &$query_options, &$join_conds, $opts)
outputChangesList($rows, $opts)
Build and output the actual changes list.
filterByCategories(&$rows, FormOptions $opts)
Filter $rows by categories set in $opts.
addModules()
Add page-specific modules.
static makeTitle($ns, $title, $fragment= '', $interwiki= '')
Create a new Title from a namespace index and a DB key.
parseParameters($par, FormOptions $opts)
Process $par and put options found in $opts.
checkLastModified()
Get last modified date, for client caching Don't use this if we are using the patrol feature...
getPageTitle($subpage=false)
Get a self-referential title object.
static namespaceSelector(array $params=[], array $selectAttribs=[])
Build a drop-down box for selecting a namespace.
Allows to change the fields on the form that will be generated $name