From bb8ae34172eff5b13a12d74469636df28b72fa40 Mon Sep 17 00:00:00 2001 From: mrbluesky Date: Thu, 13 Dec 2012 22:59:02 +0100 Subject: [PATCH] (bug 28401) Make RC en RCL honour options for rss/atom RecentChanges and RecentChangesLinked should link to atom/rss feeds using the same options as specified for the pages themselves. E.g. if somebody is looking at Special:RecentChanges&hideliu=1&namespace=1 the feed(s) should link to Special:RecentChanges&feed=atom&hideliu=1&namespace=1. All options available on RC and RCL are already supported by their feeds, except the maximum number of changes in feeds is bound by $wgFeedLimit. Change-Id: I8fb00ccd7efdd962a8a42f0bce3eac5177e2cfbd --- includes/specials/SpecialRecentchanges.php | 26 ++++++++++++++++--- .../specials/SpecialRecentchangeslinked.php | 9 ------- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/includes/specials/SpecialRecentchanges.php b/includes/specials/SpecialRecentchanges.php index 14f9c8de83..2984bc7595 100644 --- a/includes/specials/SpecialRecentchanges.php +++ b/includes/specials/SpecialRecentchanges.php @@ -480,7 +480,12 @@ class SpecialRecentChanges extends IncludableSpecialPage { } // And now for the content - $this->getOutput()->setFeedAppendQuery( $this->getFeedQuery() ); + $feedQuery = $this->getFeedQuery(); + if ( $feedQuery !== '' ) { + $this->getOutput()->setFeedAppendQuery( $feedQuery ); + } else { + $this->getOutput()->setFeedAppendQuery( false ); + } if( $wgAllowCategorizedRecentChanges ) { $this->filterByCategories( $rows, $opts ); @@ -533,11 +538,24 @@ class SpecialRecentChanges extends IncludableSpecialPage { /** * Get the query string to append to feed link URLs. - * This is overridden by RCL to add the target parameter - * @return bool + * + * @return string */ public function getFeedQuery() { - return false; + global $wgFeedLimit; + + $this->getOptions()->validateIntBounds( 'limit', 0, $wgFeedLimit ); + $options = $this->getOptions()->getChangedValues(); + + // wfArrayToCgi() omits options set to null or false + foreach ( $options as &$value ) { + if ( $value === false ) { + $value = '0'; + } + } + unset( $value ); + + return wfArrayToCgi( $options ); } /** diff --git a/includes/specials/SpecialRecentchangeslinked.php b/includes/specials/SpecialRecentchangeslinked.php index 4db89586f8..67a8609d67 100644 --- a/includes/specials/SpecialRecentchangeslinked.php +++ b/includes/specials/SpecialRecentchangeslinked.php @@ -261,15 +261,6 @@ class SpecialRecentchangeslinked extends SpecialRecentChanges { } } - public function getFeedQuery() { - $target = $this->getTargetTitle(); - if( $target ) { - return "target=" . urlencode( $target->getPrefixedDBkey() ); - } else { - return false; - } - } - function setBottomText( FormOptions $opts ) { if( isset( $this->mResultEmpty ) && $this->mResultEmpty ) { $this->getOutput()->addWikiMsg( 'recentchangeslinked-noresult' ); -- 2.20.1