From: Chad Horohoe Date: Fri, 8 Aug 2008 01:41:14 +0000 (+0000) Subject: Allow users to override the default site feed. (bug 15040) X-Git-Tag: 1.31.0-rc.0~46036 X-Git-Url: https://git.cyclocoop.org/%27.%24link.%27?a=commitdiff_plain;h=c84e9ad4a868e9a20f21957edce4eda22d85a8c6;p=lhc%2Fweb%2Fwiklou.git Allow users to override the default site feed. (bug 15040) --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 83acfaafce..27de3c39c5 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 === diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index bb0d9ed516..a47911fa1c 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -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 diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 430f2e27be..09452b9c69 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -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' ),