From 98893997b219f1142318ef18a8e220b155bbe11b Mon Sep 17 00:00:00 2001 From: Aryeh Gregor Date: Wed, 13 Jan 2010 21:29:47 +0000 Subject: [PATCH] Only advertise RSS feeds by default, not Atom Advertising both is pointless, since every feed reader in the universe supports both. Their functionality is essentially identical. And users might be given a choice of multiple feeds to read when there's really only one distinct feed. Plus, it cuts a line from the . The Atom feed still exists, and you can get the link back if you really want it with $wgAdvertisedFeedTypes. --- RELEASE-NOTES | 3 +++ includes/DefaultSettings.php | 6 ++++++ includes/OutputPage.php | 17 +++++++++-------- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 93cedefc41..5b37d23bc7 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -91,6 +91,9 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN If not specified it will default to $wgScriptPath/extensions * Added $wgCountTotalSearchHits to make search UI display total number of hits with some search engines. +* Added $wgAdvertisedFeedTypes to decide what feed types (RSS, Atom, both, or + neither) MediaWiki advertises. Default is array( 'rss' ), so Atom is no + longer advertised by default (but it still works). === New features in 1.16 === diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 50c8601353..f3a13201f3 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -2945,6 +2945,12 @@ $wgFeedDiffCutoff = 32768; */ $wgOverrideSiteFeed = array(); +/** + * Which feed types should we provide by default? This can include 'rss', + * 'atom', neither, or both. + */ +$wgAdvertisedFeedTypes = array( 'rss' ); + /** * Additional namespaces. If the namespaces defined in Language.php and * Namespace.php are insufficient, you can create new ones here, for example, diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 6498edc9bc..a2b9eaea96 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -402,14 +402,15 @@ class OutputPage { } public function setFeedAppendQuery( $val ) { - global $wgFeedClasses; + global $wgFeedClasses, $wgAdvertisedFeedTypes; $this->mFeedLinks = array(); - foreach( $wgFeedClasses as $type => $class ) { + foreach ( $wgAdvertisedFeedTypes as $type ) { $query = "feed=$type"; - if ( is_string( $val ) ) + if ( is_string( $val ) ) { $query .= '&' . $val; + } $this->mFeedLinks[$type] = $this->getTitle()->getLocalURL( $query ); } } @@ -1779,7 +1780,8 @@ class OutputPage { $tags[] = $this->feedLink( $format, $link, - wfMsg( "page-{$format}-feed", $this->getTitle()->getPrefixedText() ) ); # Used messages: 'page-rss-feed' and 'page-atom-feed' (for an easier grep) + # Used messages: 'page-rss-feed' and 'page-atom-feed' (for an easier grep) + wfMsg( "page-{$format}-feed", $this->getTitle()->getPrefixedText() ) ); } # Recent changes feed should appear on every page (except recentchanges, @@ -1790,7 +1792,7 @@ class OutputPage { # or "Breaking news" one). For this, we see if $wgOverrideSiteFeed is defined. # If so, use it instead. - global $wgOverrideSiteFeed, $wgSitename, $wgFeedClasses; + global $wgOverrideSiteFeed, $wgSitename, $wgFeedClasses, $wgAdvertisedFeedTypes; $rctitle = SpecialPage::getTitleFor( 'Recentchanges' ); if ( $wgOverrideSiteFeed ) { @@ -1800,9 +1802,8 @@ class OutputPage { htmlspecialchars( $feedUrl ), wfMsg( "site-{$type}-feed", $wgSitename ) ); } - } - else if ( $this->getTitle()->getPrefixedText() != $rctitle->getPrefixedText() ) { - foreach( $wgFeedClasses as $format => $class ) { + } elseif ( $this->getTitle()->getPrefixedText() != $rctitle->getPrefixedText() ) { + foreach ( $wgAdvertisedFeedTypes as $format ) { $tags[] = $this->feedLink( $format, $rctitle->getLocalURL( "feed={$format}" ), -- 2.20.1