Allow users to override the default site feed. (bug 15040)
authorChad Horohoe <demon@users.mediawiki.org>
Fri, 8 Aug 2008 01:41:14 +0000 (01:41 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Fri, 8 Aug 2008 01:41:14 +0000 (01:41 +0000)
RELEASE-NOTES
includes/DefaultSettings.php
includes/OutputPage.php

index 83acfaa..27de3c3 100644 (file)
@@ -25,6 +25,9 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   empt all content namespaces.)
 * $wgForwardSearchUrl has been removed entirely. Documented setting since 1.4
   has been $wgSearchForwardUrl.
+* (bug 15040) $wgOverrideSiteFeed has been added. Setting either $wgSiteFeed['rss'] 
+  or 'atom' to a URL will override the default Recent Changes feed that appears on 
+  all pages.
 
 === New features in 1.14 ===
 
index bb0d9ed..a47911f 100644 (file)
@@ -2389,6 +2389,13 @@ $wgFeedCacheTimeout = 60;
  * pages larger than this size. */
 $wgFeedDiffCutoff = 32768;
 
+/** Override the site's default RSS/ATOM feed for recentchanges that appears on
+ * every page. Some sites might have a different feed they'd like to promote 
+ * instead of the RC feed (maybe like a "Recent New Articles" or "Breaking news" one).
+ * Ex: $wgSiteFeed['format'] = "http://example.com/somefeed.xml"; Format can be one
+ * of either 'rss' or 'atom'.
+ */
+$wgOverrideSiteFeed = array();
 
 /**
  * Additional namespaces. If the namespaces defined in Language.php and
index 430f2e2..09452b9 100644 (file)
@@ -1482,12 +1482,23 @@ class OutputPage {
                        # Recent changes feed should appear on every page (except recentchanges, 
                        # that would be redundant). Put it after the per-page feed to avoid 
                        # changing existing behavior. It's still available, probably via a 
-                       # menu in your browser.
-
+                       # menu in your browser. Some sites might have a different feed they'd
+                       # like to promote instead of the RC feed (maybe like a "Recent New Articles"
+                       # or "Breaking news" one). For this, we see if $wgOverrideSiteFeed is defined.
+                       # If so, use it instead.
+                       
+                       global $wgOverrideSiteFeed, $wgSitename;
                        $rctitle = SpecialPage::getTitleFor( 'Recentchanges' );
-                       if ( $wgTitle->getPrefixedText() != $rctitle->getPrefixedText() ) {
-                               global $wgSitename;
-                               
+                       
+                       if ( isset( $wgOverrideSiteFeed['rss'] ) || isset( $wgOverrideSiteFeed['atom'] ) ) {
+                               foreach ( $wgOverrideSiteFeed as $type => $feedUrl ) { 
+                                       $tags[] = $this->feedLink (
+                                               $type,
+                                               htmlspecialchars( $feedUrl ),
+                                               wfMsg( "site-{$type}-feed", $wgSitename ) );
+                               }
+                       }
+                       else if ( $wgTitle->getPrefixedText() != $rctitle->getPrefixedText() ) {
                                $tags[] = $this->feedLink(
                                        'rss',
                                        $rctitle->getFullURL( 'feed=rss' ),