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', (int)$this->getUser()->getOption( 'rcdays' ) );
46 $opts->add( 'limit', (int)$this->getUser()->getOption( '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 $parameters array
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
;
134 * Main execution point
136 * @param $subpage String
138 public function execute( $subpage ) {
139 $this->rcSubpage
= $subpage;
140 $feedFormat = $this->including() ?
null : $this->getRequest()->getVal( 'feed' );
142 # 10 seconds server-side caching max
143 $this->getOutput()->setSquidMaxage( 10 );
144 # Check if the client has a cached version
145 $lastmod = $this->checkLastModified( $feedFormat );
146 if( $lastmod === false ) {
150 $opts = $this->getOptions();
152 $this->outputHeader();
153 $this->addRecentChangesJS();
155 // Fetch results, prepare a batch link existence check query
156 $conds = $this->buildMainQueryConds( $opts );
157 $rows = $this->doMainQuery( $conds, $opts );
158 if( $rows === false ){
159 if( !$this->including() ) {
160 $this->doHeader( $opts );
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
);
175 list( $changesFeed, $formatter ) = $this->getFeedObject( $feedFormat );
176 $changesFeed->execute( $formatter, $rows, $lastmod, $opts );
178 $this->webOutput( $rows, $opts );
185 * Return an array with a ChangesFeed object and ChannelFeed object
189 public function getFeedObject( $feedFormat ){
190 $changesFeed = new ChangesFeed( $feedFormat, 'rcfeed' );
191 $formatter = $changesFeed->getFeedObject(
192 $this->msg( 'recentchanges' )->inContentLanguage()->text(),
193 $this->msg( 'recentchanges-feed-description' )->inContentLanguage()->text(),
194 $this->getTitle()->getFullURL()
196 return array( $changesFeed, $formatter );
200 * Process $par and put options found if $opts
201 * Mainly used when including the page
204 * @param $opts FormOptions
206 public function parseParameters( $par, FormOptions
$opts ) {
207 $bits = preg_split( '/\s*,\s*/', trim( $par ) );
208 foreach( $bits as $bit ) {
209 if( 'hidebots' === $bit ) {
210 $opts['hidebots'] = true;
212 if( 'bots' === $bit ) {
213 $opts['hidebots'] = false;
215 if( 'hideminor' === $bit ) {
216 $opts['hideminor'] = true;
218 if( 'minor' === $bit ) {
219 $opts['hideminor'] = false;
221 if( 'hideliu' === $bit ) {
222 $opts['hideliu'] = true;
224 if( 'hidepatrolled' === $bit ) {
225 $opts['hidepatrolled'] = true;
227 if( 'hideanons' === $bit ) {
228 $opts['hideanons'] = true;
230 if( 'hidemyself' === $bit ) {
231 $opts['hidemyself'] = true;
234 if( is_numeric( $bit ) ) {
235 $opts['limit'] = $bit;
239 if( preg_match( '/^limit=(\d+)$/', $bit, $m ) ) {
240 $opts['limit'] = $m[1];
242 if( preg_match( '/^days=(\d+)$/', $bit, $m ) ) {
243 $opts['days'] = $m[1];
245 if( preg_match( '/^namespace=(\d+)$/', $bit, $m ) ) {
246 $opts['namespace'] = $m[1];
252 * Get last modified date, for client caching
253 * Don't use this if we are using the patrol feature, patrol changes don't
254 * update the timestamp
256 * @param $feedFormat String
257 * @return String or false
259 public function checkLastModified( $feedFormat ) {
260 $dbr = wfGetDB( DB_SLAVE
);
261 $lastmod = $dbr->selectField( 'recentchanges', 'MAX(rc_timestamp)', false, __METHOD__
);
262 if( $feedFormat ||
!$this->getUser()->useRCPatrol() ) {
263 if( $lastmod && $this->getOutput()->checkLastModified( $lastmod ) ) {
264 # Client cache fresh and headers sent, nothing more to do.
272 * Return an array of conditions depending of options set in $opts
274 * @param $opts FormOptions
277 public function buildMainQueryConds( FormOptions
$opts ) {
278 $dbr = wfGetDB( DB_SLAVE
);
281 # It makes no sense to hide both anons and logged-in users
282 # Where this occurs, force anons to be shown
284 if( $opts['hideanons'] && $opts['hideliu'] ){
285 # Check if the user wants to show bots only
286 if( $opts['hidebots'] ){
287 $opts['hideanons'] = false;
290 $opts['hidebots'] = false;
295 $cutoff_unixtime = time() - ( $opts['days'] * 86400 );
296 $cutoff_unixtime = $cutoff_unixtime - ($cutoff_unixtime %
86400);
297 $cutoff = $dbr->timestamp( $cutoff_unixtime );
299 $fromValid = preg_match('/^[0-9]{14}$/', $opts['from']);
300 if( $fromValid && $opts['from'] > wfTimestamp(TS_MW
,$cutoff) ) {
301 $cutoff = $dbr->timestamp($opts['from']);
303 $opts->reset( 'from' );
306 $conds[] = 'rc_timestamp >= ' . $dbr->addQuotes( $cutoff );
308 $hidePatrol = $this->getUser()->useRCPatrol() && $opts['hidepatrolled'];
309 $hideLoggedInUsers = $opts['hideliu'] && !$forcebot;
310 $hideAnonymousUsers = $opts['hideanons'] && !$forcebot;
312 if( $opts['hideminor'] ) {
313 $conds['rc_minor'] = 0;
315 if( $opts['hidebots'] ) {
316 $conds['rc_bot'] = 0;
319 $conds['rc_patrolled'] = 0;
322 $conds['rc_bot'] = 1;
324 if( $hideLoggedInUsers ) {
325 $conds[] = 'rc_user = 0';
327 if( $hideAnonymousUsers ) {
328 $conds[] = 'rc_user != 0';
331 if( $opts['hidemyself'] ) {
332 if( $this->getUser()->getId() ) {
333 $conds[] = 'rc_user != ' . $dbr->addQuotes( $this->getUser()->getId() );
335 $conds[] = 'rc_user_text != ' . $dbr->addQuotes( $this->getUser()->getName() );
339 # Namespace filtering
340 if( $opts['namespace'] !== '' ) {
341 $selectedNS = $dbr->addQuotes( $opts['namespace'] );
342 $operator = $opts['invert'] ?
'!=' : '=';
343 $boolean = $opts['invert'] ?
'AND' : 'OR';
345 # namespace association (bug 2429)
346 if( !$opts['associated'] ) {
347 $condition = "rc_namespace $operator $selectedNS";
349 # Also add the associated namespace
350 $associatedNS = $dbr->addQuotes(
351 MWNamespace
::getAssociated( $opts['namespace'] )
353 $condition = "(rc_namespace $operator $selectedNS "
355 . " rc_namespace $operator $associatedNS)";
358 $conds[] = $condition;
366 * @param $conds Array
367 * @param $opts FormOptions
368 * @return bool|ResultWrapper result or false (for Recentchangeslinked only)
370 public function doMainQuery( $conds, $opts ) {
371 $tables = array( 'recentchanges' );
372 $join_conds = array();
373 $query_options = array(
374 'USE INDEX' => array( 'recentchanges' => 'rc_timestamp' )
377 $uid = $this->getUser()->getId();
378 $dbr = wfGetDB( DB_SLAVE
);
379 $limit = $opts['limit'];
380 $namespace = $opts['namespace'];
381 $invert = $opts['invert'];
382 $associated = $opts['associated'];
384 $fields = RecentChange
::selectFields();
385 // JOIN on watchlist for users
387 $tables[] = 'watchlist';
388 $fields[] = 'wl_user';
389 $fields[] = 'wl_notificationtimestamp';
390 $join_conds['watchlist'] = array('LEFT JOIN',
391 "wl_user={$uid} AND wl_title=rc_title AND wl_namespace=rc_namespace");
393 if ( $this->getUser()->isAllowed( 'rollback' ) ) {
395 $fields[] = 'page_latest';
396 $join_conds['page'] = array('LEFT JOIN', 'rc_cur_id=page_id');
399 ChangeTags
::modifyDisplayQuery(
408 if ( !wfRunHooks( 'SpecialRecentChangesQuery',
409 array( &$conds, &$tables, &$join_conds, $opts, &$query_options, &$fields ) ) )
414 // Don't use the new_namespace_time timestamp index if:
415 // (a) "All namespaces" selected
416 // (b) We want pages in more than one namespace (inverted/associated)
417 // (c) There is a tag to filter on (use tag index instead)
418 // (d) UNION + sort/limit is not an option for the DBMS
419 if( $namespace === ''
420 ||
( $invert ||
$associated )
421 ||
$opts['tagfilter'] != ''
422 ||
!$dbr->unionSupportsOrderAndLimit() )
424 $res = $dbr->select( $tables, $fields, $conds, __METHOD__
,
425 array( 'ORDER BY' => 'rc_timestamp DESC', 'LIMIT' => $limit ) +
428 // We have a new_namespace_time index! UNION over new=(0,1) and sort result set!
431 $sqlNew = $dbr->selectSQLText(
434 array( 'rc_new' => 1 ) +
$conds,
437 'ORDER BY' => 'rc_timestamp DESC',
439 'USE INDEX' => array( 'recentchanges' => 'new_name_timestamp' )
444 $sqlOld = $dbr->selectSQLText(
447 array( 'rc_new' => 0 ) +
$conds,
450 'ORDER BY' => 'rc_timestamp DESC',
452 'USE INDEX' => array( 'recentchanges' => 'new_name_timestamp' )
456 # Join the two fast queries, and sort the result set
457 $sql = $dbr->unionQueries( array( $sqlNew, $sqlOld ), false ) .
458 ' ORDER BY rc_timestamp DESC';
459 $sql = $dbr->limitResult( $sql, $limit, false );
460 $res = $dbr->query( $sql, __METHOD__
);
467 * Send output to the OutputPage object, only called if not used feeds
469 * @param $rows Array of database rows
470 * @param $opts FormOptions
472 public function webOutput( $rows, $opts ) {
473 global $wgRCShowWatchingUsers, $wgShowUpdatedMarker, $wgAllowCategorizedRecentChanges;
475 $limit = $opts['limit'];
477 if( !$this->including() ) {
478 // Output options box
479 $this->doHeader( $opts );
482 // And now for the content
483 $feedQuery = $this->getFeedQuery();
484 if ( $feedQuery !== '' ) {
485 $this->getOutput()->setFeedAppendQuery( $feedQuery );
487 $this->getOutput()->setFeedAppendQuery( false );
490 if( $wgAllowCategorizedRecentChanges ) {
491 $this->filterByCategories( $rows, $opts );
494 $showWatcherCount = $wgRCShowWatchingUsers && $this->getUser()->getOption( 'shownumberswatching' );
495 $watcherCache = array();
497 $dbr = wfGetDB( DB_SLAVE
);
500 $list = ChangesList
::newFromContext( $this->getContext() );
502 $s = $list->beginRecentChangesList();
503 foreach( $rows as $obj ) {
507 $rc = RecentChange
::newFromRow( $obj );
508 $rc->counter
= $counter++
;
509 # Check if the page has been updated since the last visit
510 if( $wgShowUpdatedMarker && !empty( $obj->wl_notificationtimestamp
) ) {
511 $rc->notificationtimestamp
= ( $obj->rc_timestamp
>= $obj->wl_notificationtimestamp
);
513 $rc->notificationtimestamp
= false; // Default
515 # Check the number of users watching the page
516 $rc->numberofWatchingusers
= 0; // Default
517 if( $showWatcherCount && $obj->rc_namespace
>= 0 ) {
518 if( !isset( $watcherCache[$obj->rc_namespace
][$obj->rc_title
] ) ) {
519 $watcherCache[$obj->rc_namespace
][$obj->rc_title
] =
524 'wl_namespace' => $obj->rc_namespace
,
525 'wl_title' => $obj->rc_title
,
527 __METHOD__
. '-watchers'
530 $rc->numberofWatchingusers
= $watcherCache[$obj->rc_namespace
][$obj->rc_title
];
533 $changeLine = $list->recentChangesLine( $rc, !empty( $obj->wl_user
), $counter );
534 if ( $changeLine !== false ) {
539 $s .= $list->endRecentChangesList();
540 $this->getOutput()->addHTML( $s );
544 * Get the query string to append to feed link URLs.
548 public function getFeedQuery() {
551 $this->getOptions()->validateIntBounds( 'limit', 0, $wgFeedLimit );
552 $options = $this->getOptions()->getChangedValues();
554 // wfArrayToCgi() omits options set to null or false
555 foreach ( $options as &$value ) {
556 if ( $value === false ) {
562 return wfArrayToCgi( $options );
566 * Return the text to be displayed above the changes
568 * @param $opts FormOptions
569 * @return String: XHTML
571 public function doHeader( $opts ) {
574 $this->setTopText( $opts );
576 $defaults = $opts->getAllValues();
577 $nondefaults = $opts->getChangedValues();
578 $opts->consumeValues( array(
579 'namespace', 'invert', 'associated', 'tagfilter',
580 'categories', 'categories_any'
584 $panel[] = $this->optionsPanel( $defaults, $nondefaults );
587 $extraOpts = $this->getExtraOptions( $opts );
588 $extraOptsCount = count( $extraOpts );
590 $submit = ' ' . Xml
::submitbutton( $this->msg( 'allpagessubmit' )->text() );
592 $out = Xml
::openElement( 'table', array( 'class' => 'mw-recentchanges-table' ) );
593 foreach( $extraOpts as $name => $optionRow ) {
594 # Add submit button to the last row only
596 $addSubmit = ( $count === $extraOptsCount ) ?
$submit : '';
598 $out .= Xml
::openElement( 'tr' );
599 if( is_array( $optionRow ) ) {
600 $out .= Xml
::tags( 'td', array( 'class' => 'mw-label mw-' . $name . '-label' ), $optionRow[0] );
601 $out .= Xml
::tags( 'td', array( 'class' => 'mw-input' ), $optionRow[1] . $addSubmit );
603 $out .= Xml
::tags( 'td', array( 'class' => 'mw-input', 'colspan' => 2 ), $optionRow . $addSubmit );
605 $out .= Xml
::closeElement( 'tr' );
607 $out .= Xml
::closeElement( 'table' );
609 $unconsumed = $opts->getUnconsumedValues();
610 foreach( $unconsumed as $key => $value ) {
611 $out .= Html
::hidden( $key, $value );
614 $t = $this->getTitle();
615 $out .= Html
::hidden( 'title', $t->getPrefixedText() );
616 $form = Xml
::tags( 'form', array( 'action' => $wgScript ), $out );
618 $panelString = implode( "\n", $panel );
620 $this->getOutput()->addHTML(
621 Xml
::fieldset( $this->msg( 'recentchanges-legend' )->text(), $panelString, array( 'class' => 'rcoptions' ) )
624 $this->setBottomText( $opts );
628 * Get options to be displayed in a form
630 * @param $opts FormOptions
633 function getExtraOptions( $opts ) {
634 $extraOpts = array();
635 $extraOpts['namespace'] = $this->namespaceFilterForm( $opts );
637 global $wgAllowCategorizedRecentChanges;
638 if( $wgAllowCategorizedRecentChanges ) {
639 $extraOpts['category'] = $this->categoryFilterForm( $opts );
642 $tagFilter = ChangeTags
::buildTagFilterSelector( $opts['tagfilter'] );
643 if ( count( $tagFilter ) ) {
644 $extraOpts['tagfilter'] = $tagFilter;
647 wfRunHooks( 'SpecialRecentChangesPanel', array( &$extraOpts, $opts ) );
652 * Send the text to be displayed above the options
654 * @param $opts FormOptions
656 function setTopText( FormOptions
$opts ) {
659 $message = $this->msg( 'recentchangestext' )->inContentLanguage();
660 if ( !$message->isDisabled() ) {
661 $this->getOutput()->addWikiText(
662 Html
::rawElement( 'p',
663 array( 'lang' => $wgContLang->getCode(), 'dir' => $wgContLang->getDir() ),
664 "\n" . $message->plain() . "\n"
666 /* $lineStart */ false,
667 /* $interface */ false
673 * Send the text to be displayed after the options, for use in
674 * Recentchangeslinked
676 * @param $opts FormOptions
678 function setBottomText( FormOptions
$opts ) {}
681 * Creates the choose namespace selection
683 * @todo Uses radio buttons (HASHAR)
684 * @param $opts FormOptions
687 protected function namespaceFilterForm( FormOptions
$opts ) {
688 $nsSelect = Html
::namespaceSelector(
689 array( 'selected' => $opts['namespace'], 'all' => '' ),
690 array( 'name' => 'namespace', 'id' => 'namespace' )
692 $nsLabel = Xml
::label( $this->msg( 'namespace' )->text(), 'namespace' );
693 $invert = Xml
::checkLabel(
694 $this->msg( 'invert' )->text(), 'invert', 'nsinvert',
696 array( 'title' => $this->msg( 'tooltip-invert' )->text() )
698 $associated = Xml
::checkLabel(
699 $this->msg( 'namespace_association' )->text(), 'associated', 'nsassociated',
701 array( 'title' => $this->msg( 'tooltip-namespace_association' )->text() )
703 return array( $nsLabel, "$nsSelect $invert $associated" );
707 * Create a input to filter changes by categories
709 * @param $opts FormOptions
712 protected function categoryFilterForm( FormOptions
$opts ) {
713 list( $label, $input ) = Xml
::inputLabelSep( $this->msg( 'rc_categories' )->text(),
714 'categories', 'mw-categories', false, $opts['categories'] );
716 $input .= ' ' . Xml
::checkLabel( $this->msg( 'rc_categories_any' )->text(),
717 'categories_any', 'mw-categories_any', $opts['categories_any'] );
719 return array( $label, $input );
723 * Filter $rows by categories set in $opts
725 * @param $rows Array of database rows
726 * @param $opts FormOptions
728 function filterByCategories( &$rows, FormOptions
$opts ) {
729 $categories = array_map( 'trim', explode( '|' , $opts['categories'] ) );
731 if( !count( $categories ) ) {
737 foreach( $categories as $cat ) {
749 foreach( $rows as $k => $r ) {
750 $nt = Title
::makeTitle( $r->rc_namespace
, $r->rc_title
);
751 $id = $nt->getArticleID();
753 continue; # Page might have been deleted...
755 if( !in_array( $id, $articles ) ) {
758 if( !isset( $a2r[$id] ) ) {
766 if( !count( $articles ) ||
!count( $cats ) ) {
771 $c = new Categoryfinder
;
772 $c->seed( $articles, $cats, $opts['categories_any'] ?
'OR' : 'AND' );
777 foreach( $match as $id ) {
778 foreach( $a2r[$id] as $rev ) {
780 $newrows[$k] = $rowsarr[$k];
787 * Makes change an option link which carries all the other options
789 * @param $title Title
790 * @param $override Array: options to override
791 * @param $options Array: current options
792 * @param $active Boolean: whether to show the link in bold
795 function makeOptionsLink( $title, $override, $options, $active = false ) {
796 $params = $override +
$options;
798 // Bug 36524: false values have be converted to "0" otherwise
799 // wfArrayToCgi() will omit it them.
800 foreach ( $params as &$value ) {
801 if ( $value === false ) {
807 $text = htmlspecialchars( $title );
809 $text = '<strong>' . $text . '</strong>';
811 return Linker
::linkKnown( $this->getTitle(), $text, array(), $params );
815 * Creates the options panel.
817 * @param $defaults Array
818 * @param $nondefaults Array
821 function optionsPanel( $defaults, $nondefaults ) {
822 global $wgRCLinkLimits, $wgRCLinkDays;
824 $options = $nondefaults +
$defaults;
827 $msg = $this->msg( 'rclegend' );
828 if( !$msg->isDisabled() ) {
829 $note .= '<div class="mw-rclegend">' . $msg->parse() . "</div>\n";
832 $lang = $this->getLanguage();
833 $user = $this->getUser();
834 if( $options['from'] ) {
835 $note .= $this->msg( 'rcnotefrom' )->numParams( $options['limit'] )->params(
836 $lang->userTimeAndDate( $options['from'], $user ),
837 $lang->userDate( $options['from'], $user ),
838 $lang->userTime( $options['from'], $user ) )->parse() . '<br />';
841 # Sort data for display and make sure it's unique after we've added user data.
842 $wgRCLinkLimits[] = $options['limit'];
843 $wgRCLinkDays[] = $options['days'];
844 sort( $wgRCLinkLimits );
845 sort( $wgRCLinkDays );
846 $wgRCLinkLimits = array_unique( $wgRCLinkLimits );
847 $wgRCLinkDays = array_unique( $wgRCLinkDays );
850 foreach( $wgRCLinkLimits as $value ) {
851 $cl[] = $this->makeOptionsLink( $lang->formatNum( $value ),
852 array( 'limit' => $value ), $nondefaults, $value == $options['limit'] );
854 $cl = $lang->pipeList( $cl );
856 // day links, reset 'from' to none
857 foreach( $wgRCLinkDays as $value ) {
858 $dl[] = $this->makeOptionsLink( $lang->formatNum( $value ),
859 array( 'days' => $value, 'from' => '' ), $nondefaults, $value == $options['days'] );
861 $dl = $lang->pipeList( $dl );
865 $showhide = array( $this->msg( 'show' )->text(), $this->msg( 'hide' )->text() );
867 'hideminor' => 'rcshowhideminor',
868 'hidebots' => 'rcshowhidebots',
869 'hideanons' => 'rcshowhideanons',
870 'hideliu' => 'rcshowhideliu',
871 'hidepatrolled' => 'rcshowhidepatr',
872 'hidemyself' => 'rcshowhidemine'
874 foreach ( $this->getCustomFilters() as $key => $params ) {
875 $filters[$key] = $params['msg'];
877 // Disable some if needed
878 if ( !$user->useRCPatrol() ) {
879 unset( $filters['hidepatrolled'] );
883 foreach ( $filters as $key => $msg ) {
884 $link = $this->makeOptionsLink( $showhide[1 - $options[$key]],
885 array( $key => 1-$options[$key] ), $nondefaults );
886 $links[] = $this->msg( $msg )->rawParams( $link )->escaped();
889 // show from this onward link
890 $timestamp = wfTimestampNow();
891 $now = $lang->userTimeAndDate( $timestamp, $user );
892 $tl = $this->makeOptionsLink(
893 $now, array( 'from' => $timestamp ), $nondefaults
896 $rclinks = $this->msg( 'rclinks' )->rawParams( $cl, $dl, $lang->pipeList( $links ) )->parse();
897 $rclistfrom = $this->msg( 'rclistfrom' )->rawParams( $tl )->parse();
898 return "{$note}$rclinks<br />$rclistfrom";
902 * add javascript specific to the [[Special:RecentChanges]] page
904 function addRecentChangesJS() {
905 $this->getOutput()->addModules( array(
906 'mediawiki.special.recentchanges',