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 IncludableSpecialPage
{
30 var $rcOptions, $rcSubpage;
31 protected $customFilters;
33 public function __construct( $name = 'Recentchanges' ) {
34 parent
::__construct( $name );
38 * Get a FormOptions object containing the default options
42 public function getDefaultOptions() {
43 $opts = new FormOptions();
45 $opts->add( 'days', $this->getUser()->getIntOption( 'rcdays' ) );
46 $opts->add( 'limit', $this->getUser()->getIntOption( 'rclimit' ) );
47 $opts->add( 'from', '' );
49 $opts->add( 'hideminor', $this->getUser()->getBoolOption( 'hideminor' ) );
50 $opts->add( 'hidebots', true );
51 $opts->add( 'hideanons', false );
52 $opts->add( 'hideliu', false );
53 $opts->add( 'hidepatrolled', $this->getUser()->getBoolOption( 'hidepatrolled' ) );
54 $opts->add( 'hidemyself', false );
56 $opts->add( 'namespace', '', FormOptions
::INTNULL
);
57 $opts->add( 'invert', false );
58 $opts->add( 'associated', false );
60 $opts->add( 'categories', '' );
61 $opts->add( 'categories_any', false );
62 $opts->add( 'tagfilter', '' );
67 * Create a FormOptions object with options as specified by the user
69 * @param array $parameters
73 public function setup( $parameters ) {
74 $opts = $this->getDefaultOptions();
76 foreach ( $this->getCustomFilters() as $key => $params ) {
77 $opts->add( $key, $params['default'] );
80 $opts->fetchValuesFromRequest( $this->getRequest() );
82 // Give precedence to subpage syntax
83 if ( $parameters !== null ) {
84 $this->parseParameters( $parameters, $opts );
87 $opts->validateIntBounds( 'limit', 0, 5000 );
92 * Get custom show/hide filters
94 * @return array Map of filter URL param names to properties (msg/default)
96 protected function getCustomFilters() {
97 if ( $this->customFilters
=== null ) {
98 $this->customFilters
= array();
99 wfRunHooks( 'SpecialRecentChangesFilters', array( $this, &$this->customFilters
) );
101 return $this->customFilters
;
105 * Create a FormOptions object specific for feed requests and return it
107 * @return FormOptions
109 public function feedSetup() {
111 $opts = $this->getDefaultOptions();
112 $opts->fetchValuesFromRequest( $this->getRequest() );
113 $opts->validateIntBounds( 'limit', 0, $wgFeedLimit );
118 * Get the current FormOptions for this request
120 public function getOptions() {
121 if ( $this->rcOptions
=== null ) {
122 if ( $this->including() ) {
125 $isFeed = (bool)$this->getRequest()->getVal( 'feed' );
127 $this->rcOptions
= $isFeed ?
$this->feedSetup() : $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 $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( $feedFormat );
145 if ( $lastmod === false ) {
149 $opts = $this->getOptions();
151 $this->outputHeader();
152 $this->addRecentChangesJS();
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 );
164 if ( !$feedFormat ) {
165 $batch = new LinkBatch
;
166 foreach ( $rows as $row ) {
167 $batch->add( NS_USER
, $row->rc_user_text
);
168 $batch->add( NS_USER_TALK
, $row->rc_user_text
);
169 $batch->add( $row->rc_namespace
, $row->rc_title
);
174 list( $changesFeed, $formatter ) = $this->getFeedObject( $feedFormat );
175 /** @var ChangesFeed $changesFeed */
176 $changesFeed->execute( $formatter, $rows, $lastmod, $opts );
178 $this->webOutput( $rows, $opts );
185 * Return an array with a ChangesFeed object and ChannelFeed object
187 * @param string $feedFormat Feed's format (either 'rss' or 'atom')
190 public function getFeedObject( $feedFormat ) {
191 $changesFeed = new ChangesFeed( $feedFormat, 'rcfeed' );
192 $formatter = $changesFeed->getFeedObject(
193 $this->msg( 'recentchanges' )->inContentLanguage()->text(),
194 $this->msg( 'recentchanges-feed-description' )->inContentLanguage()->text(),
195 $this->getTitle()->getFullURL()
197 return array( $changesFeed, $formatter );
201 * Process $par and put options found if $opts
202 * Mainly used when including the page
205 * @param FormOptions $opts
207 public function parseParameters( $par, FormOptions
$opts ) {
208 $bits = preg_split( '/\s*,\s*/', trim( $par ) );
209 foreach ( $bits as $bit ) {
210 if ( 'hidebots' === $bit ) {
211 $opts['hidebots'] = true;
213 if ( 'bots' === $bit ) {
214 $opts['hidebots'] = false;
216 if ( 'hideminor' === $bit ) {
217 $opts['hideminor'] = true;
219 if ( 'minor' === $bit ) {
220 $opts['hideminor'] = false;
222 if ( 'hideliu' === $bit ) {
223 $opts['hideliu'] = true;
225 if ( 'hidepatrolled' === $bit ) {
226 $opts['hidepatrolled'] = true;
228 if ( 'hideanons' === $bit ) {
229 $opts['hideanons'] = true;
231 if ( 'hidemyself' === $bit ) {
232 $opts['hidemyself'] = true;
235 if ( is_numeric( $bit ) ) {
236 $opts['limit'] = $bit;
240 if ( preg_match( '/^limit=(\d+)$/', $bit, $m ) ) {
241 $opts['limit'] = $m[1];
243 if ( preg_match( '/^days=(\d+)$/', $bit, $m ) ) {
244 $opts['days'] = $m[1];
246 if ( preg_match( '/^namespace=(\d+)$/', $bit, $m ) ) {
247 $opts['namespace'] = $m[1];
253 * Get last modified date, for client caching
254 * Don't use this if we are using the patrol feature, patrol changes don't
255 * update the timestamp
257 * @param string $feedFormat
258 * @return string|bool
260 public function checkLastModified( $feedFormat ) {
261 $dbr = wfGetDB( DB_SLAVE
);
262 $lastmod = $dbr->selectField( 'recentchanges', 'MAX(rc_timestamp)', false, __METHOD__
);
263 if ( $feedFormat ||
!$this->getUser()->useRCPatrol() ) {
264 if ( $lastmod && $this->getOutput()->checkLastModified( $lastmod ) ) {
265 # Client cache fresh and headers sent, nothing more to do.
273 * Return an array of conditions depending of options set in $opts
275 * @param FormOptions $opts
278 public function buildMainQueryConds( FormOptions
$opts ) {
279 $dbr = wfGetDB( DB_SLAVE
);
282 # It makes no sense to hide both anons and logged-in users
283 # Where this occurs, force anons to be shown
285 if ( $opts['hideanons'] && $opts['hideliu'] ) {
286 # Check if the user wants to show bots only
287 if ( $opts['hidebots'] ) {
288 $opts['hideanons'] = false;
291 $opts['hidebots'] = false;
296 $cutoff_unixtime = time() - ( $opts['days'] * 86400 );
297 $cutoff_unixtime = $cutoff_unixtime - ($cutoff_unixtime %
86400);
298 $cutoff = $dbr->timestamp( $cutoff_unixtime );
300 $fromValid = preg_match( '/^[0-9]{14}$/', $opts['from'] );
301 if ( $fromValid && $opts['from'] > wfTimestamp( TS_MW
, $cutoff ) ) {
302 $cutoff = $dbr->timestamp( $opts['from'] );
304 $opts->reset( 'from' );
307 $conds[] = 'rc_timestamp >= ' . $dbr->addQuotes( $cutoff );
309 $hidePatrol = $this->getUser()->useRCPatrol() && $opts['hidepatrolled'];
310 $hideLoggedInUsers = $opts['hideliu'] && !$forcebot;
311 $hideAnonymousUsers = $opts['hideanons'] && !$forcebot;
313 if ( $opts['hideminor'] ) {
314 $conds['rc_minor'] = 0;
316 if ( $opts['hidebots'] ) {
317 $conds['rc_bot'] = 0;
320 $conds['rc_patrolled'] = 0;
323 $conds['rc_bot'] = 1;
325 if ( $hideLoggedInUsers ) {
326 $conds[] = 'rc_user = 0';
328 if ( $hideAnonymousUsers ) {
329 $conds[] = 'rc_user != 0';
332 if ( $opts['hidemyself'] ) {
333 if ( $this->getUser()->getId() ) {
334 $conds[] = 'rc_user != ' . $dbr->addQuotes( $this->getUser()->getId() );
336 $conds[] = 'rc_user_text != ' . $dbr->addQuotes( $this->getUser()->getName() );
340 # Namespace filtering
341 if ( $opts['namespace'] !== '' ) {
342 $selectedNS = $dbr->addQuotes( $opts['namespace'] );
343 $operator = $opts['invert'] ?
'!=' : '=';
344 $boolean = $opts['invert'] ?
'AND' : 'OR';
346 # namespace association (bug 2429)
347 if ( !$opts['associated'] ) {
348 $condition = "rc_namespace $operator $selectedNS";
350 # Also add the associated namespace
351 $associatedNS = $dbr->addQuotes(
352 MWNamespace
::getAssociated( $opts['namespace'] )
354 $condition = "(rc_namespace $operator $selectedNS "
356 . " rc_namespace $operator $associatedNS)";
359 $conds[] = $condition;
367 * @param array $conds
368 * @param FormOptions $opts
369 * @return bool|ResultWrapper Result or false (for Recentchangeslinked only)
371 public function doMainQuery( $conds, $opts ) {
372 $tables = array( 'recentchanges' );
373 $join_conds = array();
374 $query_options = array(
375 'USE INDEX' => array( 'recentchanges' => 'rc_timestamp' )
378 $uid = $this->getUser()->getId();
379 $dbr = wfGetDB( DB_SLAVE
);
380 $limit = $opts['limit'];
381 $namespace = $opts['namespace'];
382 $invert = $opts['invert'];
383 $associated = $opts['associated'];
385 $fields = RecentChange
::selectFields();
386 // JOIN on watchlist for users
388 $tables[] = 'watchlist';
389 $fields[] = 'wl_user';
390 $fields[] = 'wl_notificationtimestamp';
391 $join_conds['watchlist'] = array( 'LEFT JOIN', array(
394 'wl_namespace=rc_namespace'
397 if ( $this->getUser()->isAllowed( 'rollback' ) ) {
399 $fields[] = 'page_latest';
400 $join_conds['page'] = array( 'LEFT JOIN', 'rc_cur_id=page_id' );
403 ChangeTags
::modifyDisplayQuery(
412 if ( !wfRunHooks( 'SpecialRecentChangesQuery',
413 array( &$conds, &$tables, &$join_conds, $opts, &$query_options, &$fields ) ) )
418 // Don't use the new_namespace_time timestamp index if:
419 // (a) "All namespaces" selected
420 // (b) We want pages in more than one namespace (inverted/associated)
421 // (c) There is a tag to filter on (use tag index instead)
422 // (d) UNION + sort/limit is not an option for the DBMS
423 if ( $namespace === ''
424 ||
( $invert ||
$associated )
425 ||
$opts['tagfilter'] != ''
426 ||
!$dbr->unionSupportsOrderAndLimit() )
428 $res = $dbr->select( $tables, $fields, $conds, __METHOD__
,
429 array( 'ORDER BY' => 'rc_timestamp DESC', 'LIMIT' => $limit ) +
432 // We have a new_namespace_time index! UNION over new=(0,1) and sort result set!
435 $sqlNew = $dbr->selectSQLText(
438 array( 'rc_new' => 1 ) +
$conds,
441 'ORDER BY' => 'rc_timestamp DESC',
443 'USE INDEX' => array( 'recentchanges' => 'new_name_timestamp' )
448 $sqlOld = $dbr->selectSQLText(
451 array( 'rc_new' => 0 ) +
$conds,
454 'ORDER BY' => 'rc_timestamp DESC',
456 'USE INDEX' => array( 'recentchanges' => 'new_name_timestamp' )
460 # Join the two fast queries, and sort the result set
461 $sql = $dbr->unionQueries( array( $sqlNew, $sqlOld ), false ) .
462 ' ORDER BY rc_timestamp DESC';
463 $sql = $dbr->limitResult( $sql, $limit, false );
464 $res = $dbr->query( $sql, __METHOD__
);
471 * Send output to the OutputPage object, only called if not used feeds
473 * @param array $rows Database rows
474 * @param FormOptions $opts
476 public function webOutput( $rows, $opts ) {
477 global $wgRCShowWatchingUsers, $wgShowUpdatedMarker, $wgAllowCategorizedRecentChanges;
479 $limit = $opts['limit'];
481 if ( !$this->including() ) {
482 // Output options box
483 $this->doHeader( $opts );
486 // And now for the content
487 $feedQuery = $this->getFeedQuery();
488 if ( $feedQuery !== '' ) {
489 $this->getOutput()->setFeedAppendQuery( $feedQuery );
491 $this->getOutput()->setFeedAppendQuery( false );
494 if ( $wgAllowCategorizedRecentChanges ) {
495 $this->filterByCategories( $rows, $opts );
498 $showWatcherCount = $wgRCShowWatchingUsers && $this->getUser()->getOption( 'shownumberswatching' );
499 $watcherCache = array();
501 $dbr = wfGetDB( DB_SLAVE
);
504 $list = ChangesList
::newFromContext( $this->getContext() );
506 $s = $list->beginRecentChangesList();
507 foreach ( $rows as $obj ) {
511 $rc = RecentChange
::newFromRow( $obj );
512 $rc->counter
= $counter++
;
513 # Check if the page has been updated since the last visit
514 if ( $wgShowUpdatedMarker && !empty( $obj->wl_notificationtimestamp
) ) {
515 $rc->notificationtimestamp
= ( $obj->rc_timestamp
>= $obj->wl_notificationtimestamp
);
517 $rc->notificationtimestamp
= false; // Default
519 # Check the number of users watching the page
520 $rc->numberofWatchingusers
= 0; // Default
521 if ( $showWatcherCount && $obj->rc_namespace
>= 0 ) {
522 if ( !isset( $watcherCache[$obj->rc_namespace
][$obj->rc_title
] ) ) {
523 $watcherCache[$obj->rc_namespace
][$obj->rc_title
] =
528 'wl_namespace' => $obj->rc_namespace
,
529 'wl_title' => $obj->rc_title
,
531 __METHOD__
. '-watchers'
534 $rc->numberofWatchingusers
= $watcherCache[$obj->rc_namespace
][$obj->rc_title
];
537 $changeLine = $list->recentChangesLine( $rc, !empty( $obj->wl_user
), $counter );
538 if ( $changeLine !== false ) {
543 $s .= $list->endRecentChangesList();
544 $this->getOutput()->addHTML( $s );
548 * Get the query string to append to feed link URLs.
552 public function getFeedQuery() {
555 $this->getOptions()->validateIntBounds( 'limit', 0, $wgFeedLimit );
556 $options = $this->getOptions()->getChangedValues();
558 // wfArrayToCgi() omits options set to null or false
559 foreach ( $options as &$value ) {
560 if ( $value === false ) {
566 return wfArrayToCgi( $options );
570 * Return the text to be displayed above the changes
572 * @param FormOptions $opts
573 * @return string XHTML
575 public function doHeader( $opts ) {
578 $this->setTopText( $opts );
580 $defaults = $opts->getAllValues();
581 $nondefaults = $opts->getChangedValues();
582 $opts->consumeValues( array(
583 'namespace', 'invert', 'associated', 'tagfilter',
584 'categories', 'categories_any'
588 $panel[] = $this->optionsPanel( $defaults, $nondefaults );
591 $extraOpts = $this->getExtraOptions( $opts );
592 $extraOptsCount = count( $extraOpts );
594 $submit = ' ' . Xml
::submitbutton( $this->msg( 'allpagessubmit' )->text() );
596 $out = Xml
::openElement( 'table', array( 'class' => 'mw-recentchanges-table' ) );
597 foreach ( $extraOpts as $name => $optionRow ) {
598 # Add submit button to the last row only
600 $addSubmit = ( $count === $extraOptsCount ) ?
$submit : '';
602 $out .= Xml
::openElement( 'tr' );
603 if ( is_array( $optionRow ) ) {
604 $out .= Xml
::tags( 'td', array( 'class' => 'mw-label mw-' . $name . '-label' ), $optionRow[0] );
605 $out .= Xml
::tags( 'td', array( 'class' => 'mw-input' ), $optionRow[1] . $addSubmit );
607 $out .= Xml
::tags( 'td', array( 'class' => 'mw-input', 'colspan' => 2 ), $optionRow . $addSubmit );
609 $out .= Xml
::closeElement( 'tr' );
611 $out .= Xml
::closeElement( 'table' );
613 $unconsumed = $opts->getUnconsumedValues();
614 foreach ( $unconsumed as $key => $value ) {
615 $out .= Html
::hidden( $key, $value );
618 $t = $this->getTitle();
619 $out .= Html
::hidden( 'title', $t->getPrefixedText() );
620 $form = Xml
::tags( 'form', array( 'action' => $wgScript ), $out );
622 $panelString = implode( "\n", $panel );
624 $this->getOutput()->addHTML(
625 Xml
::fieldset( $this->msg( 'recentchanges-legend' )->text(), $panelString, array( 'class' => 'rcoptions' ) )
628 $this->setBottomText( $opts );
632 * Get options to be displayed in a form
634 * @param FormOptions $opts
637 function getExtraOptions( $opts ) {
638 $extraOpts = array();
639 $extraOpts['namespace'] = $this->namespaceFilterForm( $opts );
641 global $wgAllowCategorizedRecentChanges;
642 if ( $wgAllowCategorizedRecentChanges ) {
643 $extraOpts['category'] = $this->categoryFilterForm( $opts );
646 $tagFilter = ChangeTags
::buildTagFilterSelector( $opts['tagfilter'] );
647 if ( count( $tagFilter ) ) {
648 $extraOpts['tagfilter'] = $tagFilter;
651 wfRunHooks( 'SpecialRecentChangesPanel', array( &$extraOpts, $opts ) );
656 * Send the text to be displayed above the options
658 * @param FormOptions $opts Unused
660 function setTopText( FormOptions
$opts ) {
663 $message = $this->msg( 'recentchangestext' )->inContentLanguage();
664 if ( !$message->isDisabled() ) {
665 $this->getOutput()->addWikiText(
666 Html
::rawElement( 'p',
667 array( 'lang' => $wgContLang->getCode(), 'dir' => $wgContLang->getDir() ),
668 "\n" . $message->plain() . "\n"
670 /* $lineStart */ false,
671 /* $interface */ false
677 * Send the text to be displayed after the options, for use in
678 * Recentchangeslinked
680 * @param FormOptions $opts
682 function setBottomText( FormOptions
$opts ) {}
685 * Creates the choose namespace selection
687 * @todo Uses radio buttons (HASHAR)
688 * @param FormOptions $opts
691 protected function namespaceFilterForm( FormOptions
$opts ) {
692 $nsSelect = Html
::namespaceSelector(
693 array( 'selected' => $opts['namespace'], 'all' => '' ),
694 array( 'name' => 'namespace', 'id' => 'namespace' )
696 $nsLabel = Xml
::label( $this->msg( 'namespace' )->text(), 'namespace' );
697 $invert = Xml
::checkLabel(
698 $this->msg( 'invert' )->text(), 'invert', 'nsinvert',
700 array( 'title' => $this->msg( 'tooltip-invert' )->text() )
702 $associated = Xml
::checkLabel(
703 $this->msg( 'namespace_association' )->text(), 'associated', 'nsassociated',
705 array( 'title' => $this->msg( 'tooltip-namespace_association' )->text() )
707 return array( $nsLabel, "$nsSelect $invert $associated" );
711 * Create a input to filter changes by categories
713 * @param FormOptions $opts
716 protected function categoryFilterForm( FormOptions
$opts ) {
717 list( $label, $input ) = Xml
::inputLabelSep( $this->msg( 'rc_categories' )->text(),
718 'categories', 'mw-categories', false, $opts['categories'] );
720 $input .= ' ' . Xml
::checkLabel( $this->msg( 'rc_categories_any' )->text(),
721 'categories_any', 'mw-categories_any', $opts['categories_any'] );
723 return array( $label, $input );
727 * Filter $rows by categories set in $opts
729 * @param array $rows Database rows
730 * @param FormOptions $opts
732 function filterByCategories( &$rows, FormOptions
$opts ) {
733 $categories = array_map( 'trim', explode( '|', $opts['categories'] ) );
735 if ( !count( $categories ) ) {
741 foreach ( $categories as $cat ) {
753 foreach ( $rows as $k => $r ) {
754 $nt = Title
::makeTitle( $r->rc_namespace
, $r->rc_title
);
755 $id = $nt->getArticleID();
757 continue; # Page might have been deleted...
759 if ( !in_array( $id, $articles ) ) {
762 if ( !isset( $a2r[$id] ) ) {
770 if ( !count( $articles ) ||
!count( $cats ) ) {
775 $c = new Categoryfinder
;
776 $c->seed( $articles, $cats, $opts['categories_any'] ?
'OR' : 'AND' );
781 foreach ( $match as $id ) {
782 foreach ( $a2r[$id] as $rev ) {
784 $newrows[$k] = $rowsarr[$k];
791 * Makes change an option link which carries all the other options
793 * @param string $title Title
794 * @param array $override Options to override
795 * @param array $options Current options
796 * @param bool $active Whether to show the link in bold
799 function makeOptionsLink( $title, $override, $options, $active = false ) {
800 $params = $override +
$options;
802 // Bug 36524: false values have be converted to "0" otherwise
803 // wfArrayToCgi() will omit it them.
804 foreach ( $params as &$value ) {
805 if ( $value === false ) {
811 $text = htmlspecialchars( $title );
813 $text = '<strong>' . $text . '</strong>';
815 return Linker
::linkKnown( $this->getTitle(), $text, array(), $params );
819 * Creates the options panel.
821 * @param array $defaults
822 * @param array $nondefaults
825 function optionsPanel( $defaults, $nondefaults ) {
826 global $wgRCLinkLimits, $wgRCLinkDays;
828 $options = $nondefaults +
$defaults;
831 $msg = $this->msg( 'rclegend' );
832 if ( !$msg->isDisabled() ) {
833 $note .= '<div class="mw-rclegend">' . $msg->parse() . "</div>\n";
836 $lang = $this->getLanguage();
837 $user = $this->getUser();
838 if ( $options['from'] ) {
839 $note .= $this->msg( 'rcnotefrom' )->numParams( $options['limit'] )->params(
840 $lang->userTimeAndDate( $options['from'], $user ),
841 $lang->userDate( $options['from'], $user ),
842 $lang->userTime( $options['from'], $user ) )->parse() . '<br />';
845 # Sort data for display and make sure it's unique after we've added user data.
846 $wgRCLinkLimits[] = $options['limit'];
847 $wgRCLinkDays[] = $options['days'];
848 sort( $wgRCLinkLimits );
849 sort( $wgRCLinkDays );
850 $wgRCLinkLimits = array_unique( $wgRCLinkLimits );
851 $wgRCLinkDays = array_unique( $wgRCLinkDays );
855 foreach ( $wgRCLinkLimits as $value ) {
856 $cl[] = $this->makeOptionsLink( $lang->formatNum( $value ),
857 array( 'limit' => $value ), $nondefaults, $value == $options['limit'] );
859 $cl = $lang->pipeList( $cl );
861 // day links, reset 'from' to none
863 foreach ( $wgRCLinkDays as $value ) {
864 $dl[] = $this->makeOptionsLink( $lang->formatNum( $value ),
865 array( 'days' => $value, 'from' => '' ), $nondefaults, $value == $options['days'] );
867 $dl = $lang->pipeList( $dl );
870 $showhide = array( $this->msg( 'show' )->text(), $this->msg( 'hide' )->text() );
872 'hideminor' => 'rcshowhideminor',
873 'hidebots' => 'rcshowhidebots',
874 'hideanons' => 'rcshowhideanons',
875 'hideliu' => 'rcshowhideliu',
876 'hidepatrolled' => 'rcshowhidepatr',
877 'hidemyself' => 'rcshowhidemine'
879 foreach ( $this->getCustomFilters() as $key => $params ) {
880 $filters[$key] = $params['msg'];
882 // Disable some if needed
883 if ( !$user->useRCPatrol() ) {
884 unset( $filters['hidepatrolled'] );
888 foreach ( $filters as $key => $msg ) {
889 $link = $this->makeOptionsLink( $showhide[1 - $options[$key]],
890 array( $key => 1 - $options[$key] ), $nondefaults );
891 $links[] = $this->msg( $msg )->rawParams( $link )->escaped();
894 // show from this onward link
895 $timestamp = wfTimestampNow();
896 $now = $lang->userTimeAndDate( $timestamp, $user );
897 $tl = $this->makeOptionsLink(
898 $now, array( 'from' => $timestamp ), $nondefaults
901 $rclinks = $this->msg( 'rclinks' )->rawParams( $cl, $dl, $lang->pipeList( $links ) )->parse();
902 $rclistfrom = $this->msg( 'rclistfrom' )->rawParams( $tl )->parse();
903 return "{$note}$rclinks<br />$rclistfrom";
907 * add javascript specific to the [[Special:RecentChanges]] page
909 function addRecentChangesJS() {
910 $this->getOutput()->addModules( array(
911 'mediawiki.special.recentchanges',
915 protected function getGroupName() {