Only advertise RSS feeds by default, not Atom
authorAryeh Gregor <simetrical@users.mediawiki.org>
Wed, 13 Jan 2010 21:29:47 +0000 (21:29 +0000)
committerAryeh Gregor <simetrical@users.mediawiki.org>
Wed, 13 Jan 2010 21:29:47 +0000 (21:29 +0000)
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 <head>.  The Atom
feed still exists, and you can get the <head> link back if you really
want it with $wgAdvertisedFeedTypes.

RELEASE-NOTES
includes/DefaultSettings.php
includes/OutputPage.php

index 93cedef..5b37d23 100644 (file)
@@ -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 ===
index 50c8601..f3a1320 100644 (file)
@@ -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,
index 6498edc..a2b9eae 100644 (file)
@@ -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}" ),