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 # Feed is cached on limit,hideminor,namespace; other params would randomly not work
113 $opts->fetchValuesFromRequest( $this->getRequest(), array( 'limit', 'hideminor', 'namespace' ) );
114 $opts->validateIntBounds( 'limit', 0, $wgFeedLimit );
119 * Get the current FormOptions for this request
121 public function getOptions() {
122 if ( $this->rcOptions
=== null ) {
123 if ( $this->including() ) {
126 $isFeed = (bool)$this->getRequest()->getVal( 'feed' );
128 $this->rcOptions
= $isFeed ?
$this->feedSetup() : $this->setup( $this->rcSubpage
);
130 return $this->rcOptions
;
135 * Main execution point
137 * @param $subpage String
139 public function execute( $subpage ) {
140 $this->rcSubpage
= $subpage;
141 $feedFormat = $this->including() ?
null : $this->getRequest()->getVal( 'feed' );
143 # 10 seconds server-side caching max
144 $this->getOutput()->setSquidMaxage( 10 );
145 # Check if the client has a cached version
146 $lastmod = $this->checkLastModified( $feedFormat );
147 if( $lastmod === false ) {
151 $opts = $this->getOptions();
153 $this->outputHeader();
154 $this->addRecentChangesJS();
156 // Fetch results, prepare a batch link existence check query
157 $conds = $this->buildMainQueryConds( $opts );
158 $rows = $this->doMainQuery( $conds, $opts );
159 if( $rows === false ){
160 if( !$this->including() ) {
161 $this->doHeader( $opts );
167 $batch = new LinkBatch
;
168 foreach( $rows as $row ) {
169 $batch->add( NS_USER
, $row->rc_user_text
);
170 $batch->add( NS_USER_TALK
, $row->rc_user_text
);
171 $batch->add( $row->rc_namespace
, $row->rc_title
);
176 list( $changesFeed, $formatter ) = $this->getFeedObject( $feedFormat );
177 $changesFeed->execute( $formatter, $rows, $lastmod, $opts );
179 $this->webOutput( $rows, $opts );
186 * Return an array with a ChangesFeed object and ChannelFeed object
190 public function getFeedObject( $feedFormat ){
191 $changesFeed = new ChangesFeed( $feedFormat, 'rcfeed' );
192 $formatter = $changesFeed->getFeedObject(
193 wfMsgForContent( 'recentchanges' ),
194 wfMsgForContent( 'recentchanges-feed-description' ),
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 $opts FormOptions
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 $feedFormat String
258 * @return String or false
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 $opts FormOptions
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 $conds Array
368 * @param $opts FormOptions
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 = array( $dbr->tableName( 'recentchanges' ) . '.*' ); // all rc columns
386 // JOIN on watchlist for users
388 $tables[] = 'watchlist';
389 $fields[] = 'wl_user';
390 $fields[] = 'wl_notificationtimestamp';
391 $join_conds['watchlist'] = array('LEFT JOIN',
392 "wl_user={$uid} AND wl_title=rc_title AND wl_namespace=rc_namespace");
394 if ( $this->getUser()->isAllowed( 'rollback' ) ) {
396 $fields[] = 'page_latest';
397 $join_conds['page'] = array('LEFT JOIN', 'rc_cur_id=page_id');
399 if ( !$this->including() ) {
401 // Doesn't work when transcluding. See bug 23293
402 ChangeTags
::modifyDisplayQuery(
403 $tables, $fields, $conds, $join_conds, $query_options,
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 $this->getOutput()->setFeedAppendQuery( $this->getFeedQuery() );
485 if( $wgAllowCategorizedRecentChanges ) {
486 $this->filterByCategories( $rows, $opts );
489 $showWatcherCount = $wgRCShowWatchingUsers && $this->getUser()->getOption( 'shownumberswatching' );
490 $watcherCache = array();
492 $dbr = wfGetDB( DB_SLAVE
);
495 $list = ChangesList
::newFromContext( $this->getContext() );
497 $s = $list->beginRecentChangesList();
498 foreach( $rows as $obj ) {
502 $rc = RecentChange
::newFromRow( $obj );
503 $rc->counter
= $counter++
;
504 # Check if the page has been updated since the last visit
505 if( $wgShowUpdatedMarker && !empty( $obj->wl_notificationtimestamp
) ) {
506 $rc->notificationtimestamp
= ( $obj->rc_timestamp
>= $obj->wl_notificationtimestamp
);
508 $rc->notificationtimestamp
= false; // Default
510 # Check the number of users watching the page
511 $rc->numberofWatchingusers
= 0; // Default
512 if( $showWatcherCount && $obj->rc_namespace
>= 0 ) {
513 if( !isset( $watcherCache[$obj->rc_namespace
][$obj->rc_title
] ) ) {
514 $watcherCache[$obj->rc_namespace
][$obj->rc_title
] =
519 'wl_namespace' => $obj->rc_namespace
,
520 'wl_title' => $obj->rc_title
,
522 __METHOD__
. '-watchers'
525 $rc->numberofWatchingusers
= $watcherCache[$obj->rc_namespace
][$obj->rc_title
];
527 $s .= $list->recentChangesLine( $rc, !empty( $obj->wl_user
), $counter );
530 $s .= $list->endRecentChangesList();
531 $this->getOutput()->addHTML( $s );
535 * Get the query string to append to feed link URLs.
536 * This is overridden by RCL to add the target parameter
539 public function getFeedQuery() {
544 * Return the text to be displayed above the changes
546 * @param $opts FormOptions
547 * @return String: XHTML
549 public function doHeader( $opts ) {
552 $this->setTopText( $opts );
554 $defaults = $opts->getAllValues();
555 $nondefaults = $opts->getChangedValues();
556 $opts->consumeValues( array(
557 'namespace', 'invert', 'associated', 'tagfilter',
558 'categories', 'categories_any'
562 $panel[] = $this->optionsPanel( $defaults, $nondefaults );
565 $extraOpts = $this->getExtraOptions( $opts );
566 $extraOptsCount = count( $extraOpts );
568 $submit = ' ' . Xml
::submitbutton( wfMsg( 'allpagessubmit' ) );
570 $out = Xml
::openElement( 'table', array( 'class' => 'mw-recentchanges-table' ) );
571 foreach( $extraOpts as $name => $optionRow ) {
572 # Add submit button to the last row only
574 $addSubmit = ( $count === $extraOptsCount ) ?
$submit : '';
576 $out .= Xml
::openElement( 'tr' );
577 if( is_array( $optionRow ) ) {
578 $out .= Xml
::tags( 'td', array( 'class' => 'mw-label mw-' . $name . '-label' ), $optionRow[0] );
579 $out .= Xml
::tags( 'td', array( 'class' => 'mw-input' ), $optionRow[1] . $addSubmit );
581 $out .= Xml
::tags( 'td', array( 'class' => 'mw-input', 'colspan' => 2 ), $optionRow . $addSubmit );
583 $out .= Xml
::closeElement( 'tr' );
585 $out .= Xml
::closeElement( 'table' );
587 $unconsumed = $opts->getUnconsumedValues();
588 foreach( $unconsumed as $key => $value ) {
589 $out .= Html
::hidden( $key, $value );
592 $t = $this->getTitle();
593 $out .= Html
::hidden( 'title', $t->getPrefixedText() );
594 $form = Xml
::tags( 'form', array( 'action' => $wgScript ), $out );
596 $panelString = implode( "\n", $panel );
598 $this->getOutput()->addHTML(
599 Xml
::fieldset( wfMsg( 'recentchanges-legend' ), $panelString, array( 'class' => 'rcoptions' ) )
602 $this->setBottomText( $opts );
606 * Get options to be displayed in a form
608 * @param $opts FormOptions
611 function getExtraOptions( $opts ) {
612 $extraOpts = array();
613 $extraOpts['namespace'] = $this->namespaceFilterForm( $opts );
615 global $wgAllowCategorizedRecentChanges;
616 if( $wgAllowCategorizedRecentChanges ) {
617 $extraOpts['category'] = $this->categoryFilterForm( $opts );
620 $tagFilter = ChangeTags
::buildTagFilterSelector( $opts['tagfilter'] );
621 if ( count( $tagFilter ) ) {
622 $extraOpts['tagfilter'] = $tagFilter;
625 wfRunHooks( 'SpecialRecentChangesPanel', array( &$extraOpts, $opts ) );
630 * Send the text to be displayed above the options
632 * @param $opts FormOptions
634 function setTopText( FormOptions
$opts ) {
636 $this->getOutput()->addWikiText(
637 Html
::rawElement( 'p',
638 array( 'lang' => $wgContLang->getCode(), 'dir' => $wgContLang->getDir() ),
639 "\n" . wfMsgForContentNoTrans( 'recentchangestext' ) . "\n"
641 /* $lineStart */ false,
642 /* $interface */ false
647 * Send the text to be displayed after the options, for use in
648 * Recentchangeslinked
650 * @param $opts FormOptions
652 function setBottomText( FormOptions
$opts ) {}
655 * Creates the choose namespace selection
657 * @todo Uses radio buttons (HASHAR)
658 * @param $opts FormOptions
661 protected function namespaceFilterForm( FormOptions
$opts ) {
662 $nsSelect = Html
::namespaceSelector(
663 array( 'selected' => $opts['namespace'], 'all' => '' ),
664 array( 'name' => 'namespace', 'id' => 'namespace' )
666 $nsLabel = Xml
::label( wfMsg( 'namespace' ), 'namespace' );
667 $invert = Xml
::checkLabel(
668 wfMsg( 'invert' ), 'invert', 'nsinvert',
670 array( 'title' => wfMsg( 'tooltip-invert' ) )
672 $associated = Xml
::checkLabel(
673 wfMsg( 'namespace_association' ), 'associated', 'nsassociated',
675 array( 'title' => wfMsg( 'tooltip-namespace_association' ) )
677 return array( $nsLabel, "$nsSelect $invert $associated" );
681 * Create a input to filter changes by categories
683 * @param $opts FormOptions
686 protected function categoryFilterForm( FormOptions
$opts ) {
687 list( $label, $input ) = Xml
::inputLabelSep( wfMsg( 'rc_categories' ),
688 'categories', 'mw-categories', false, $opts['categories'] );
690 $input .= ' ' . Xml
::checkLabel( wfMsg( 'rc_categories_any' ),
691 'categories_any', 'mw-categories_any', $opts['categories_any'] );
693 return array( $label, $input );
697 * Filter $rows by categories set in $opts
699 * @param $rows Array of database rows
700 * @param $opts FormOptions
702 function filterByCategories( &$rows, FormOptions
$opts ) {
703 $categories = array_map( 'trim', explode( '|' , $opts['categories'] ) );
705 if( !count( $categories ) ) {
711 foreach( $categories as $cat ) {
723 foreach( $rows as $k => $r ) {
724 $nt = Title
::makeTitle( $r->rc_namespace
, $r->rc_title
);
725 $id = $nt->getArticleID();
727 continue; # Page might have been deleted...
729 if( !in_array( $id, $articles ) ) {
732 if( !isset( $a2r[$id] ) ) {
740 if( !count( $articles ) ||
!count( $cats ) ) {
745 $c = new Categoryfinder
;
746 $c->seed( $articles, $cats, $opts['categories_any'] ?
'OR' : 'AND' );
751 foreach( $match as $id ) {
752 foreach( $a2r[$id] as $rev ) {
754 $newrows[$k] = $rowsarr[$k];
761 * Makes change an option link which carries all the other options
763 * @param $title Title
764 * @param $override Array: options to override
765 * @param $options Array: current options
766 * @param $active Boolean: whether to show the link in bold
769 function makeOptionsLink( $title, $override, $options, $active = false ) {
770 $params = $override +
$options;
771 $text = htmlspecialchars( $title );
773 $text = '<strong>' . $text . '</strong>';
775 return Linker
::linkKnown( $this->getTitle(), $text, array(), $params );
779 * Creates the options panel.
781 * @param $defaults Array
782 * @param $nondefaults Array
785 function optionsPanel( $defaults, $nondefaults ) {
786 global $wgRCLinkLimits, $wgRCLinkDays;
788 $options = $nondefaults +
$defaults;
791 if( !wfEmptyMsg( 'rclegend' ) ) {
792 $note .= '<div class="mw-rclegend">' .
793 wfMsgExt( 'rclegend', array( 'parseinline' ) ) . "</div>\n";
795 if( $options['from'] ) {
796 $note .= wfMsgExt( 'rcnotefrom', array( 'parseinline' ),
797 $this->getLanguage()->formatNum( $options['limit'] ),
798 $this->getLanguage()->timeanddate( $options['from'], true ),
799 $this->getLanguage()->date( $options['from'], true ),
800 $this->getLanguage()->time( $options['from'], true ) ) . '<br />';
803 # Sort data for display and make sure it's unique after we've added user data.
804 $wgRCLinkLimits[] = $options['limit'];
805 $wgRCLinkDays[] = $options['days'];
806 sort( $wgRCLinkLimits );
807 sort( $wgRCLinkDays );
808 $wgRCLinkLimits = array_unique( $wgRCLinkLimits );
809 $wgRCLinkDays = array_unique( $wgRCLinkDays );
812 foreach( $wgRCLinkLimits as $value ) {
813 $cl[] = $this->makeOptionsLink( $this->getLanguage()->formatNum( $value ),
814 array( 'limit' => $value ), $nondefaults, $value == $options['limit'] );
816 $cl = $this->getLanguage()->pipeList( $cl );
818 // day links, reset 'from' to none
819 foreach( $wgRCLinkDays as $value ) {
820 $dl[] = $this->makeOptionsLink( $this->getLanguage()->formatNum( $value ),
821 array( 'days' => $value, 'from' => '' ), $nondefaults, $value == $options['days'] );
823 $dl = $this->getLanguage()->pipeList( $dl );
827 $showhide = array( wfMsg( 'show' ), wfMsg( 'hide' ) );
829 'hideminor' => 'rcshowhideminor',
830 'hidebots' => 'rcshowhidebots',
831 'hideanons' => 'rcshowhideanons',
832 'hideliu' => 'rcshowhideliu',
833 'hidepatrolled' => 'rcshowhidepatr',
834 'hidemyself' => 'rcshowhidemine'
836 foreach ( $this->getCustomFilters() as $key => $params ) {
837 $filters[$key] = $params['msg'];
839 // Disable some if needed
840 if ( !$this->getUser()->useRCPatrol() ) {
841 unset( $filters['hidepatrolled'] );
845 foreach ( $filters as $key => $msg ) {
846 $link = $this->makeOptionsLink( $showhide[1 - $options[$key]],
847 array( $key => 1-$options[$key] ), $nondefaults );
848 $links[] = wfMsgHtml( $msg, $link );
851 // show from this onward link
852 $timestamp = wfTimestampNow();
853 $now = $this->getLanguage()->timeanddate( $timestamp, true );
854 $tl = $this->makeOptionsLink(
855 $now, array( 'from' => $timestamp ), $nondefaults
858 $rclinks = wfMsgExt( 'rclinks', array( 'parseinline', 'replaceafter' ),
859 $cl, $dl, $this->getLanguage()->pipeList( $links ) );
860 $rclistfrom = wfMsgExt( 'rclistfrom', array( 'parseinline', 'replaceafter' ), $tl );
861 return "{$note}$rclinks<br />$rclistfrom";
865 * add javascript specific to the [[Special:RecentChanges]] page
867 function addRecentChangesJS() {
868 $this->getOutput()->addModules( array(
869 'mediawiki.special.recentchanges',