3 * Implements Special:Recentchanges
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
21 * @ingroup SpecialPage
25 * A special page that lists last changes made to the wiki
27 * @ingroup SpecialPage
29 class SpecialRecentChanges
extends SpecialPage
{
30 var $rcOptions, $rcSubpage;
31 protected $customFilters;
34 * The feed format to output as (either 'rss' or 'atom'), or null if no
35 * feed output was requested
37 * @var string $feedFormat
39 protected $feedFormat;
41 public function __construct( $name = 'Recentchanges', $restriction = '' ) {
42 parent
::__construct( $name, $restriction );
45 public function isIncludable() {
50 * Get a FormOptions object containing the default options
54 public function getDefaultOptions() {
55 $opts = new FormOptions();
56 $user = $this->getUser();
58 $opts->add( 'days', $user->getIntOption( 'rcdays' ) );
59 $opts->add( 'limit', $user->getIntOption( 'rclimit' ) );
60 $opts->add( 'from', '' );
62 $opts->add( 'hideminor', $user->getBoolOption( 'hideminor' ) );
63 $opts->add( 'hidebots', true );
64 $opts->add( 'hideanons', false );
65 $opts->add( 'hideliu', false );
66 $opts->add( 'hidepatrolled', $user->getBoolOption( 'hidepatrolled' ) );
67 $opts->add( 'hidemyself', false );
69 $opts->add( 'namespace', '', FormOptions
::INTNULL
);
70 $opts->add( 'invert', false );
71 $opts->add( 'associated', false );
73 $opts->add( 'categories', '' );
74 $opts->add( 'categories_any', false );
75 $opts->add( 'tagfilter', '' );
81 * Create a FormOptions object with options as specified by the user
83 * @param array $parameters
86 public function setup( $parameters ) {
89 $opts = $this->getDefaultOptions();
91 foreach ( $this->getCustomFilters() as $key => $params ) {
92 $opts->add( $key, $params['default'] );
95 $opts->fetchValuesFromRequest( $this->getRequest() );
97 // Give precedence to subpage syntax
98 if ( $parameters !== null ) {
99 $this->parseParameters( $parameters, $opts );
102 $opts->validateIntBounds( 'limit', 0, $this->feedFormat ?
$wgFeedLimit : 5000 );
108 * Get custom show/hide filters
110 * @return array Map of filter URL param names to properties (msg/default)
112 protected function getCustomFilters() {
113 if ( $this->customFilters
=== null ) {
114 $this->customFilters
= array();
115 wfRunHooks( 'SpecialRecentChangesFilters', array( $this, &$this->customFilters
) );
118 return $this->customFilters
;
122 * Get the current FormOptions for this request
124 public function getOptions() {
125 if ( $this->rcOptions
=== null ) {
126 $this->rcOptions
= $this->setup( $this->rcSubpage
);
129 return $this->rcOptions
;
133 * Main execution point
135 * @param string $subpage
137 public function execute( $subpage ) {
138 $this->rcSubpage
= $subpage;
139 $this->feedFormat
= $this->including() ?
null : $this->getRequest()->getVal( 'feed' );
141 # 10 seconds server-side caching max
142 $this->getOutput()->setSquidMaxage( 10 );
143 # Check if the client has a cached version
144 $lastmod = $this->checkLastModified( $this->feedFormat
);
145 if ( $lastmod === false ) {
149 $opts = $this->getOptions();
151 $this->outputHeader();
154 // Fetch results, prepare a batch link existence check query
155 $conds = $this->buildMainQueryConds( $opts );
156 $rows = $this->doMainQuery( $conds, $opts );
157 if ( $rows === false ) {
158 if ( !$this->including() ) {
159 $this->doHeader( $opts );
165 if ( !$this->feedFormat
) {
166 $batch = new LinkBatch
;
167 foreach ( $rows as $row ) {
168 $batch->add( NS_USER
, $row->rc_user_text
);
169 $batch->add( NS_USER_TALK
, $row->rc_user_text
);
170 $batch->add( $row->rc_namespace
, $row->rc_title
);
174 if ( $this->feedFormat
) {
175 list( $changesFeed, $formatter ) = $this->getFeedObject( $this->feedFormat
);
176 /** @var ChangesFeed $changesFeed */
177 $changesFeed->execute( $formatter, $rows, $lastmod, $opts );
179 $this->webOutput( $rows, $opts );
186 * Return an array with a ChangesFeed object and ChannelFeed object
188 * @param string $feedFormat Feed's format (either 'rss' or 'atom')
191 public function getFeedObject( $feedFormat ) {
192 $changesFeed = new ChangesFeed( $feedFormat, 'rcfeed' );
193 $formatter = $changesFeed->getFeedObject(
194 $this->msg( 'recentchanges' )->inContentLanguage()->text(),
195 $this->msg( 'recentchanges-feed-description' )->inContentLanguage()->text(),
196 $this->getPageTitle()->getFullURL()
199 return array( $changesFeed, $formatter );
203 * Process $par and put options found if $opts
204 * Mainly used when including the page
207 * @param FormOptions $opts
209 public function parseParameters( $par, FormOptions
$opts ) {
210 $bits = preg_split( '/\s*,\s*/', trim( $par ) );
211 foreach ( $bits as $bit ) {
212 if ( 'hidebots' === $bit ) {
213 $opts['hidebots'] = true;
215 if ( 'bots' === $bit ) {
216 $opts['hidebots'] = false;
218 if ( 'hideminor' === $bit ) {
219 $opts['hideminor'] = true;
221 if ( 'minor' === $bit ) {
222 $opts['hideminor'] = false;
224 if ( 'hideliu' === $bit ) {
225 $opts['hideliu'] = true;
227 if ( 'hidepatrolled' === $bit ) {
228 $opts['hidepatrolled'] = true;
230 if ( 'hideanons' === $bit ) {
231 $opts['hideanons'] = true;
233 if ( 'hidemyself' === $bit ) {
234 $opts['hidemyself'] = true;
237 if ( is_numeric( $bit ) ) {
238 $opts['limit'] = $bit;
242 if ( preg_match( '/^limit=(\d+)$/', $bit, $m ) ) {
243 $opts['limit'] = $m[1];
245 if ( preg_match( '/^days=(\d+)$/', $bit, $m ) ) {
246 $opts['days'] = $m[1];
248 if ( preg_match( '/^namespace=(\d+)$/', $bit, $m ) ) {
249 $opts['namespace'] = $m[1];
255 * Get last modified date, for client caching
256 * Don't use this if we are using the patrol feature, patrol changes don't
257 * update the timestamp
259 * @param string $feedFormat
260 * @return string|bool
262 public function checkLastModified( $feedFormat ) {
263 $dbr = wfGetDB( DB_SLAVE
);
264 $lastmod = $dbr->selectField( 'recentchanges', 'MAX(rc_timestamp)', false, __METHOD__
);
265 if ( $feedFormat ||
!$this->getUser()->useRCPatrol() ) {
266 if ( $lastmod && $this->getOutput()->checkLastModified( $lastmod ) ) {
267 # Client cache fresh and headers sent, nothing more to do.
276 * Return an array of conditions depending of options set in $opts
278 * @param FormOptions $opts
281 public function buildMainQueryConds( FormOptions
$opts ) {
282 $dbr = wfGetDB( DB_SLAVE
);
285 # It makes no sense to hide both anons and logged-in users
286 # Where this occurs, force anons to be shown
288 if ( $opts['hideanons'] && $opts['hideliu'] ) {
289 # Check if the user wants to show bots only
290 if ( $opts['hidebots'] ) {
291 $opts['hideanons'] = false;
294 $opts['hidebots'] = false;
299 $cutoff_unixtime = time() - ( $opts['days'] * 86400 );
300 $cutoff_unixtime = $cutoff_unixtime - ( $cutoff_unixtime %
86400 );
301 $cutoff = $dbr->timestamp( $cutoff_unixtime );
303 $fromValid = preg_match( '/^[0-9]{14}$/', $opts['from'] );
304 if ( $fromValid && $opts['from'] > wfTimestamp( TS_MW
, $cutoff ) ) {
305 $cutoff = $dbr->timestamp( $opts['from'] );
307 $opts->reset( 'from' );
310 $conds[] = 'rc_timestamp >= ' . $dbr->addQuotes( $cutoff );
312 $hidePatrol = $this->getUser()->useRCPatrol() && $opts['hidepatrolled'];
313 $hideLoggedInUsers = $opts['hideliu'] && !$forcebot;
314 $hideAnonymousUsers = $opts['hideanons'] && !$forcebot;
316 if ( $opts['hideminor'] ) {
317 $conds['rc_minor'] = 0;
319 if ( $opts['hidebots'] ) {
320 $conds['rc_bot'] = 0;
323 $conds['rc_patrolled'] = 0;
326 $conds['rc_bot'] = 1;
328 if ( $hideLoggedInUsers ) {
329 $conds[] = 'rc_user = 0';
331 if ( $hideAnonymousUsers ) {
332 $conds[] = 'rc_user != 0';
335 if ( $opts['hidemyself'] ) {
336 if ( $this->getUser()->getId() ) {
337 $conds[] = 'rc_user != ' . $dbr->addQuotes( $this->getUser()->getId() );
339 $conds[] = 'rc_user_text != ' . $dbr->addQuotes( $this->getUser()->getName() );
343 # Namespace filtering
344 if ( $opts['namespace'] !== '' ) {
345 $selectedNS = $dbr->addQuotes( $opts['namespace'] );
346 $operator = $opts['invert'] ?
'!=' : '=';
347 $boolean = $opts['invert'] ?
'AND' : 'OR';
349 # namespace association (bug 2429)
350 if ( !$opts['associated'] ) {
351 $condition = "rc_namespace $operator $selectedNS";
353 # Also add the associated namespace
354 $associatedNS = $dbr->addQuotes(
355 MWNamespace
::getAssociated( $opts['namespace'] )
357 $condition = "(rc_namespace $operator $selectedNS "
359 . " rc_namespace $operator $associatedNS)";
362 $conds[] = $condition;
371 * @param array $conds
372 * @param FormOptions $opts
373 * @return bool|ResultWrapper Result or false (for Recentchangeslinked only)
375 public function doMainQuery( $conds, $opts ) {
376 $tables = array( 'recentchanges' );
377 $join_conds = array();
378 $query_options = array();
380 $uid = $this->getUser()->getId();
381 $dbr = wfGetDB( DB_SLAVE
);
382 $limit = $opts['limit'];
383 $namespace = $opts['namespace'];
384 $invert = $opts['invert'];
385 $associated = $opts['associated'];
387 $fields = RecentChange
::selectFields();
388 // JOIN on watchlist for users
389 if ( $uid && $this->getUser()->isAllowed( 'viewmywatchlist' ) ) {
390 $tables[] = 'watchlist';
391 $fields[] = 'wl_user';
392 $fields[] = 'wl_notificationtimestamp';
393 $join_conds['watchlist'] = array( 'LEFT JOIN', array(
396 'wl_namespace=rc_namespace'
399 if ( $this->getUser()->isAllowed( 'rollback' ) ) {
401 $fields[] = 'page_latest';
402 $join_conds['page'] = array( 'LEFT JOIN', 'rc_cur_id=page_id' );
405 ChangeTags
::modifyDisplayQuery(
414 if ( !wfRunHooks( 'SpecialRecentChangesQuery',
415 array( &$conds, &$tables, &$join_conds, $opts, &$query_options, &$fields ) )
420 // rc_new is not an ENUM, but adding a redundant rc_new IN (0,1) gives mysql enough
421 // knowledge to use an index merge if it wants (it may use some other index though).
425 $conds +
array( 'rc_new' => array( 0, 1 ) ),
427 array( 'ORDER BY' => 'rc_timestamp DESC', 'LIMIT' => $limit ) +
$query_options,
433 * Send output to the OutputPage object, only called if not used feeds
435 * @param array $rows Database rows
436 * @param FormOptions $opts
438 public function webOutput( $rows, $opts ) {
439 global $wgRCShowWatchingUsers, $wgShowUpdatedMarker, $wgAllowCategorizedRecentChanges;
441 // Build the final data
443 if ( $wgAllowCategorizedRecentChanges ) {
444 $this->filterByCategories( $rows, $opts );
447 $limit = $opts['limit'];
449 $showWatcherCount = $wgRCShowWatchingUsers && $this->getUser()->getOption( 'shownumberswatching' );
450 $watcherCache = array();
452 $dbr = wfGetDB( DB_SLAVE
);
455 $list = ChangesList
::newFromContext( $this->getContext() );
457 $rclistOutput = $list->beginRecentChangesList();
458 foreach ( $rows as $obj ) {
462 $rc = RecentChange
::newFromRow( $obj );
463 $rc->counter
= $counter++
;
464 # Check if the page has been updated since the last visit
465 if ( $wgShowUpdatedMarker && !empty( $obj->wl_notificationtimestamp
) ) {
466 $rc->notificationtimestamp
= ( $obj->rc_timestamp
>= $obj->wl_notificationtimestamp
);
468 $rc->notificationtimestamp
= false; // Default
470 # Check the number of users watching the page
471 $rc->numberofWatchingusers
= 0; // Default
472 if ( $showWatcherCount && $obj->rc_namespace
>= 0 ) {
473 if ( !isset( $watcherCache[$obj->rc_namespace
][$obj->rc_title
] ) ) {
474 $watcherCache[$obj->rc_namespace
][$obj->rc_title
] =
479 'wl_namespace' => $obj->rc_namespace
,
480 'wl_title' => $obj->rc_title
,
482 __METHOD__
. '-watchers'
485 $rc->numberofWatchingusers
= $watcherCache[$obj->rc_namespace
][$obj->rc_title
];
488 $changeLine = $list->recentChangesLine( $rc, !empty( $obj->wl_user
), $counter );
489 if ( $changeLine !== false ) {
490 $rclistOutput .= $changeLine;
494 $rclistOutput .= $list->endRecentChangesList();
498 if ( !$this->including() ) {
499 // Output options box
500 $this->doHeader( $opts );
503 // And now for the content
504 $feedQuery = $this->getFeedQuery();
505 if ( $feedQuery !== '' ) {
506 $this->getOutput()->setFeedAppendQuery( $feedQuery );
508 $this->getOutput()->setFeedAppendQuery( false );
511 if ( $rows->numRows() === 0 ) {
512 $this->getOutput()->addHtml(
513 '<div class="mw-changeslist-empty">' . $this->msg( 'recentchanges-noresult' )->parse() . '</div>'
516 $this->getOutput()->addHTML( $rclistOutput );
521 * Get the query string to append to feed link URLs.
525 public function getFeedQuery() {
528 $this->getOptions()->validateIntBounds( 'limit', 0, $wgFeedLimit );
529 $options = $this->getOptions()->getChangedValues();
531 // wfArrayToCgi() omits options set to null or false
532 foreach ( $options as &$value ) {
533 if ( $value === false ) {
539 return wfArrayToCgi( $options );
543 * Return the text to be displayed above the changes
545 * @param FormOptions $opts
546 * @return string XHTML
548 public function doHeader( $opts ) {
551 $this->setTopText( $opts );
553 $defaults = $opts->getAllValues();
554 $nondefaults = $opts->getChangedValues();
557 $panel[] = self
::makeLegend( $this->getContext() );
558 $panel[] = $this->optionsPanel( $defaults, $nondefaults );
561 $extraOpts = $this->getExtraOptions( $opts );
562 $extraOptsCount = count( $extraOpts );
564 $submit = ' ' . Xml
::submitbutton( $this->msg( 'allpagessubmit' )->text() );
566 $out = Xml
::openElement( 'table', array( 'class' => 'mw-recentchanges-table' ) );
567 foreach ( $extraOpts as $name => $optionRow ) {
568 # Add submit button to the last row only
570 $addSubmit = ( $count === $extraOptsCount ) ?
$submit : '';
572 $out .= Xml
::openElement( 'tr' );
573 if ( is_array( $optionRow ) ) {
576 array( 'class' => 'mw-label mw-' . $name . '-label' ),
581 array( 'class' => 'mw-input' ),
582 $optionRow[1] . $addSubmit
587 array( 'class' => 'mw-input', 'colspan' => 2 ),
588 $optionRow . $addSubmit
591 $out .= Xml
::closeElement( 'tr' );
593 $out .= Xml
::closeElement( 'table' );
595 $unconsumed = $opts->getUnconsumedValues();
596 foreach ( $unconsumed as $key => $value ) {
597 $out .= Html
::hidden( $key, $value );
600 $t = $this->getPageTitle();
601 $out .= Html
::hidden( 'title', $t->getPrefixedText() );
602 $form = Xml
::tags( 'form', array( 'action' => $wgScript ), $out );
604 $panelString = implode( "\n", $panel );
606 $this->getOutput()->addHTML(
608 $this->msg( 'recentchanges-legend' )->text(),
610 array( 'class' => 'rcoptions' )
614 $this->setBottomText( $opts );
618 * Get options to be displayed in a form
620 * @param FormOptions $opts
623 function getExtraOptions( $opts ) {
624 $opts->consumeValues( array(
625 'namespace', 'invert', 'associated', 'tagfilter', 'categories', 'categories_any'
628 $extraOpts = array();
629 $extraOpts['namespace'] = $this->namespaceFilterForm( $opts );
631 global $wgAllowCategorizedRecentChanges;
632 if ( $wgAllowCategorizedRecentChanges ) {
633 $extraOpts['category'] = $this->categoryFilterForm( $opts );
636 $tagFilter = ChangeTags
::buildTagFilterSelector( $opts['tagfilter'] );
637 if ( count( $tagFilter ) ) {
638 $extraOpts['tagfilter'] = $tagFilter;
641 // Don't fire the hook for subclasses. (Or should we?)
642 if ( $this->getName() === 'Recentchanges' ) {
643 wfRunHooks( 'SpecialRecentChangesPanel', array( &$extraOpts, $opts ) );
650 * Return the legend displayed within the fieldset.
652 * This method is also called from SpecialWatchlist.
654 * @param $context the object available as $this in non-static functions
657 public static function makeLegend( IContextSource
$context ) {
658 global $wgRecentChangesFlags;
659 $user = $context->getUser();
660 # The legend showing what the letters and stuff mean
661 $legend = Xml
::openElement( 'dl' ) . "\n";
662 # Iterates through them and gets the messages for both letter and tooltip
663 $legendItems = $wgRecentChangesFlags;
664 if ( !$user->useRCPatrol() ) {
665 unset( $legendItems['unpatrolled'] );
667 foreach ( $legendItems as $key => $legendInfo ) { # generate items of the legend
668 $label = $legendInfo['title'];
669 $letter = $legendInfo['letter'];
670 $cssClass = isset( $legendInfo['class'] ) ?
$legendInfo['class'] : $key;
672 $legend .= Xml
::element( 'dt',
673 array( 'class' => $cssClass ), $context->msg( $letter )->text()
675 if ( $key === 'newpage' ) {
676 $legend .= Xml
::openElement( 'dd' );
677 $legend .= $context->msg( $label )->escaped();
678 $legend .= ' ' . $context->msg( 'recentchanges-legend-newpage' )->parse();
679 $legend .= Xml
::closeElement( 'dd' ) . "\n";
681 $legend .= Xml
::element( 'dd', array(),
682 $context->msg( $label )->text()
687 $legend .= Xml
::tags( 'dt',
688 array( 'class' => 'mw-plusminus-pos' ),
689 $context->msg( 'recentchanges-legend-plusminus' )->parse()
691 $legend .= Xml
::element(
693 array( 'class' => 'mw-changeslist-legend-plusminus' ),
694 $context->msg( 'recentchanges-label-plusminus' )->text()
696 $legend .= Xml
::closeElement( 'dl' ) . "\n";
700 '<div class="mw-changeslist-legend">' .
701 $context->msg( 'recentchanges-legend-heading' )->parse() .
702 '<div class="mw-collapsible-content">' . $legend . '</div>' .
709 * Send the text to be displayed above the options
711 * @param FormOptions $opts Unused
713 function setTopText( FormOptions
$opts ) {
716 $message = $this->msg( 'recentchangestext' )->inContentLanguage();
717 if ( !$message->isDisabled() ) {
718 $this->getOutput()->addWikiText(
719 Html
::rawElement( 'p',
720 array( 'lang' => $wgContLang->getCode(), 'dir' => $wgContLang->getDir() ),
721 "\n" . $message->plain() . "\n"
723 /* $lineStart */ false,
724 /* $interface */ false
730 * Send the text to be displayed after the options, for use in subclasses.
732 * @param FormOptions $opts
734 function setBottomText( FormOptions
$opts ) {
738 * Creates the choose namespace selection
740 * @param FormOptions $opts
743 protected function namespaceFilterForm( FormOptions
$opts ) {
744 $nsSelect = Html
::namespaceSelector(
745 array( 'selected' => $opts['namespace'], 'all' => '' ),
746 array( 'name' => 'namespace', 'id' => 'namespace' )
748 $nsLabel = Xml
::label( $this->msg( 'namespace' )->text(), 'namespace' );
749 $invert = Xml
::checkLabel(
750 $this->msg( 'invert' )->text(), 'invert', 'nsinvert',
752 array( 'title' => $this->msg( 'tooltip-invert' )->text() )
754 $associated = Xml
::checkLabel(
755 $this->msg( 'namespace_association' )->text(), 'associated', 'nsassociated',
757 array( 'title' => $this->msg( 'tooltip-namespace_association' )->text() )
760 return array( $nsLabel, "$nsSelect $invert $associated" );
764 * Create a input to filter changes by categories
766 * @param FormOptions $opts
769 protected function categoryFilterForm( FormOptions
$opts ) {
770 list( $label, $input ) = Xml
::inputLabelSep( $this->msg( 'rc_categories' )->text(),
771 'categories', 'mw-categories', false, $opts['categories'] );
773 $input .= ' ' . Xml
::checkLabel( $this->msg( 'rc_categories_any' )->text(),
774 'categories_any', 'mw-categories_any', $opts['categories_any'] );
776 return array( $label, $input );
780 * Filter $rows by categories set in $opts
782 * @param array $rows Database rows
783 * @param FormOptions $opts
785 function filterByCategories( &$rows, FormOptions
$opts ) {
786 $categories = array_map( 'trim', explode( '|', $opts['categories'] ) );
788 if ( !count( $categories ) ) {
794 foreach ( $categories as $cat ) {
806 foreach ( $rows as $k => $r ) {
807 $nt = Title
::makeTitle( $r->rc_namespace
, $r->rc_title
);
808 $id = $nt->getArticleID();
810 continue; # Page might have been deleted...
812 if ( !in_array( $id, $articles ) ) {
815 if ( !isset( $a2r[$id] ) ) {
823 if ( !count( $articles ) ||
!count( $cats ) ) {
828 $c = new Categoryfinder
;
829 $c->seed( $articles, $cats, $opts['categories_any'] ?
'OR' : 'AND' );
834 foreach ( $match as $id ) {
835 foreach ( $a2r[$id] as $rev ) {
837 $newrows[$k] = $rowsarr[$k];
844 * Makes change an option link which carries all the other options
846 * @param string $title Title
847 * @param array $override Options to override
848 * @param array $options Current options
849 * @param bool $active Whether to show the link in bold
852 function makeOptionsLink( $title, $override, $options, $active = false ) {
853 $params = $override +
$options;
855 // Bug 36524: false values have be converted to "0" otherwise
856 // wfArrayToCgi() will omit it them.
857 foreach ( $params as &$value ) {
858 if ( $value === false ) {
864 $text = htmlspecialchars( $title );
866 $text = '<strong>' . $text . '</strong>';
869 return Linker
::linkKnown( $this->getPageTitle(), $text, array(), $params );
873 * Creates the options panel.
875 * @param array $defaults
876 * @param array $nondefaults
879 function optionsPanel( $defaults, $nondefaults ) {
880 global $wgRCLinkLimits, $wgRCLinkDays;
882 $options = $nondefaults +
$defaults;
885 $msg = $this->msg( 'rclegend' );
886 if ( !$msg->isDisabled() ) {
887 $note .= '<div class="mw-rclegend">' . $msg->parse() . "</div>\n";
890 $lang = $this->getLanguage();
891 $user = $this->getUser();
892 if ( $options['from'] ) {
893 $note .= $this->msg( 'rcnotefrom' )->numParams( $options['limit'] )->params(
894 $lang->userTimeAndDate( $options['from'], $user ),
895 $lang->userDate( $options['from'], $user ),
896 $lang->userTime( $options['from'], $user ) )->parse() . '<br />';
899 # Sort data for display and make sure it's unique after we've added user data.
900 $linkLimits = $wgRCLinkLimits;
901 $linkLimits[] = $options['limit'];
903 $linkLimits = array_unique( $linkLimits );
905 $linkDays = $wgRCLinkDays;
906 $linkDays[] = $options['days'];
908 $linkDays = array_unique( $linkDays );
912 foreach ( $linkLimits as $value ) {
913 $cl[] = $this->makeOptionsLink( $lang->formatNum( $value ),
914 array( 'limit' => $value ), $nondefaults, $value == $options['limit'] );
916 $cl = $lang->pipeList( $cl );
918 // day links, reset 'from' to none
920 foreach ( $linkDays as $value ) {
921 $dl[] = $this->makeOptionsLink( $lang->formatNum( $value ),
922 array( 'days' => $value, 'from' => '' ), $nondefaults, $value == $options['days'] );
924 $dl = $lang->pipeList( $dl );
927 $showhide = array( $this->msg( 'show' )->text(), $this->msg( 'hide' )->text() );
929 'hideminor' => 'rcshowhideminor',
930 'hidebots' => 'rcshowhidebots',
931 'hideanons' => 'rcshowhideanons',
932 'hideliu' => 'rcshowhideliu',
933 'hidepatrolled' => 'rcshowhidepatr',
934 'hidemyself' => 'rcshowhidemine'
936 foreach ( $this->getCustomFilters() as $key => $params ) {
937 $filters[$key] = $params['msg'];
939 // Disable some if needed
940 if ( !$user->useRCPatrol() ) {
941 unset( $filters['hidepatrolled'] );
945 foreach ( $filters as $key => $msg ) {
946 $link = $this->makeOptionsLink( $showhide[1 - $options[$key]],
947 array( $key => 1 - $options[$key] ), $nondefaults );
948 $links[] = $this->msg( $msg )->rawParams( $link )->escaped();
951 // show from this onward link
952 $timestamp = wfTimestampNow();
953 $now = $lang->userTimeAndDate( $timestamp, $user );
954 $tl = $this->makeOptionsLink(
955 $now, array( 'from' => $timestamp ), $nondefaults
958 $rclinks = $this->msg( 'rclinks' )->rawParams( $cl, $dl, $lang->pipeList( $links ) )
960 $rclistfrom = $this->msg( 'rclistfrom' )->rawParams( $tl )->parse();
962 return "{$note}$rclinks<br />$rclistfrom";
966 * Add page-specific modules.
968 protected function addModules() {
969 $this->getOutput()->addModules( array(
970 'mediawiki.special.recentchanges',
974 protected function getGroupName() {