r38831 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r38830‎ | r38831 | r38832 >
Date:01:41, 8 August 2008
Author:demon
Status:old
Tags:
Comment:
Allow users to override the default site feed. (bug 15040)
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/OutputPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/OutputPage.php
@@ -1482,12 +1482,23 @@
14831483 # Recent changes feed should appear on every page (except recentchanges,
14841484 # that would be redundant). Put it after the per-page feed to avoid
14851485 # changing existing behavior. It's still available, probably via a
1486 - # menu in your browser.
1487 -
 1486+ # menu in your browser. Some sites might have a different feed they'd
 1487+ # like to promote instead of the RC feed (maybe like a "Recent New Articles"
 1488+ # or "Breaking news" one). For this, we see if $wgOverrideSiteFeed is defined.
 1489+ # If so, use it instead.
 1490+
 1491+ global $wgOverrideSiteFeed, $wgSitename;
14881492 $rctitle = SpecialPage::getTitleFor( 'Recentchanges' );
1489 - if ( $wgTitle->getPrefixedText() != $rctitle->getPrefixedText() ) {
1490 - global $wgSitename;
1491 -
 1493+
 1494+ if ( isset( $wgOverrideSiteFeed['rss'] ) || isset( $wgOverrideSiteFeed['atom'] ) ) {
 1495+ foreach ( $wgOverrideSiteFeed as $type => $feedUrl ) {
 1496+ $tags[] = $this->feedLink (
 1497+ $type,
 1498+ htmlspecialchars( $feedUrl ),
 1499+ wfMsg( "site-{$type}-feed", $wgSitename ) );
 1500+ }
 1501+ }
 1502+ else if ( $wgTitle->getPrefixedText() != $rctitle->getPrefixedText() ) {
14921503 $tags[] = $this->feedLink(
14931504 'rss',
14941505 $rctitle->getFullURL( 'feed=rss' ),
Index: trunk/phase3/includes/DefaultSettings.php
@@ -2389,6 +2389,13 @@
23902390 * pages larger than this size. */
23912391 $wgFeedDiffCutoff = 32768;
23922392
 2393+/** Override the site's default RSS/ATOM feed for recentchanges that appears on
 2394+ * every page. Some sites might have a different feed they'd like to promote
 2395+ * instead of the RC feed (maybe like a "Recent New Articles" or "Breaking news" one).
 2396+ * Ex: $wgSiteFeed['format'] = "http://example.com/somefeed.xml"; Format can be one
 2397+ * of either 'rss' or 'atom'.
 2398+ */
 2399+$wgOverrideSiteFeed = array();
23932400
23942401 /**
23952402 * Additional namespaces. If the namespaces defined in Language.php and
Index: trunk/phase3/RELEASE-NOTES
@@ -25,6 +25,9 @@
2626 empt all content namespaces.)
2727 * $wgForwardSearchUrl has been removed entirely. Documented setting since 1.4
2828 has been $wgSearchForwardUrl.
 29+* (bug 15040) $wgOverrideSiteFeed has been added. Setting either $wgSiteFeed['rss']
 30+ or 'atom' to a URL will override the default Recent Changes feed that appears on
 31+ all pages.
2932
3033 === New features in 1.14 ===
3134

Follow-up revisions

RevisionCommit summaryAuthorDate
r38950Cleanup to r38831 -- don't check _just_ 'rss' and 'atom', take anything. :)brion21:02, 8 August 2008

Status & tagging log