| Index: trunk/phase3/includes/SpecialRecentchanges.php |
| — | — | @@ -326,6 +326,13 @@ |
| 327 | 327 | function rcOutputFeed( $rows, $feedFormat, $limit, $hideminor, $lastmod ) { |
| 328 | 328 | global $messageMemc, $wgFeedCacheTimeout; |
| 329 | 329 | global $wgFeedClasses, $wgTitle, $wgSitename, $wgContLanguageCode; |
| | 330 | + global $wgFeed; |
| | 331 | + |
| | 332 | + if ( !$wgFeed ) { |
| | 333 | + global $wgOut; |
| | 334 | + $wgOut->addWikiMsg( 'feed-unavailable' ); |
| | 335 | + return; |
| | 336 | + } |
| 330 | 337 | |
| 331 | 338 | if( !isset( $wgFeedClasses[$feedFormat] ) ) { |
| 332 | 339 | wfHttpError( 500, "Internal Server Error", "Unsupported feed type." ); |
| Index: trunk/phase3/includes/OutputPage.php |
| — | — | @@ -1337,7 +1337,7 @@ |
| 1338 | 1338 | * @return string HTML tag links to be put in the header. |
| 1339 | 1339 | */ |
| 1340 | 1340 | public function getHeadLinks() { |
| 1341 | | - global $wgRequest; |
| | 1341 | + global $wgRequest, $wgFeed; |
| 1342 | 1342 | $ret = ''; |
| 1343 | 1343 | foreach ( $this->mMetatags as $tag ) { |
| 1344 | 1344 | if ( 0 == strcasecmp( 'http:', substr( $tag[0], 0, 5 ) ) ) { |
| — | — | @@ -1372,33 +1372,35 @@ |
| 1373 | 1373 | $ret .= " />\n"; |
| 1374 | 1374 | } |
| 1375 | 1375 | |
| 1376 | | - foreach( $this->getSyndicationLinks() as $format => $link ) { |
| 1377 | | - # Use the page name for the title (accessed through $wgTitle since |
| 1378 | | - # there's no other way). In principle, this could lead to issues |
| 1379 | | - # with having the same name for different feeds corresponding to |
| 1380 | | - # the same page, but we can't avoid that at this low a level. |
| 1381 | | - global $wgTitle; |
| 1382 | | - |
| | 1376 | + if( $wgFeed ) { |
| | 1377 | + foreach( $this->getSyndicationLinks() as $format => $link ) { |
| | 1378 | + # Use the page name for the title (accessed through $wgTitle since |
| | 1379 | + # there's no other way). In principle, this could lead to issues |
| | 1380 | + # with having the same name for different feeds corresponding to |
| | 1381 | + # the same page, but we can't avoid that at this low a level. |
| | 1382 | + global $wgTitle; |
| | 1383 | + |
| | 1384 | + $ret .= $this->feedLink( |
| | 1385 | + $format, |
| | 1386 | + $link, |
| | 1387 | + wfMsg( "page-{$format}-feed", $wgTitle->getPrefixedText() ) ); # Used messages: 'page-rss-feed' and 'page-atom-feed' (for an easier grep) |
| | 1388 | + } |
| | 1389 | + |
| | 1390 | + # Recent changes feed should appear on every page |
| | 1391 | + # Put it after the per-page feed to avoid changing existing behavior. |
| | 1392 | + # It's still available, probably via a menu in your browser. |
| | 1393 | + global $wgSitename; |
| | 1394 | + $rctitle = SpecialPage::getTitleFor( 'Recentchanges' ); |
| 1383 | 1395 | $ret .= $this->feedLink( |
| 1384 | | - $format, |
| 1385 | | - $link, |
| 1386 | | - wfMsg( "page-{$format}-feed", $wgTitle->getPrefixedText() ) ); # Used messages: 'page-rss-feed' and 'page-atom-feed' (for an easier grep) |
| | 1396 | + 'rss', |
| | 1397 | + $rctitle->getFullURL( 'feed=rss' ), |
| | 1398 | + wfMsg( 'site-rss-feed', $wgSitename ) ); |
| | 1399 | + $ret .= $this->feedLink( |
| | 1400 | + 'atom', |
| | 1401 | + $rctitle->getFullURL( 'feed=atom' ), |
| | 1402 | + wfMsg( 'site-atom-feed', $wgSitename ) ); |
| 1387 | 1403 | } |
| 1388 | 1404 | |
| 1389 | | - # Recent changes feed should appear on every page |
| 1390 | | - # Put it after the per-page feed to avoid changing existing behavior. |
| 1391 | | - # It's still available, probably via a menu in your browser. |
| 1392 | | - global $wgSitename; |
| 1393 | | - $rctitle = SpecialPage::getTitleFor( 'Recentchanges' ); |
| 1394 | | - $ret .= $this->feedLink( |
| 1395 | | - 'rss', |
| 1396 | | - $rctitle->getFullURL( 'feed=rss' ), |
| 1397 | | - wfMsg( 'site-rss-feed', $wgSitename ) ); |
| 1398 | | - $ret .= $this->feedLink( |
| 1399 | | - 'atom', |
| 1400 | | - $rctitle->getFullURL( 'feed=atom' ), |
| 1401 | | - wfMsg( 'site-atom-feed', $wgSitename ) ); |
| 1402 | | - |
| 1403 | 1405 | return $ret; |
| 1404 | 1406 | } |
| 1405 | 1407 | |
| Index: trunk/phase3/includes/DefaultSettings.php |
| — | — | @@ -2164,6 +2164,9 @@ |
| 2165 | 2165 | /** Use new page patrolling to check new pages on special:Newpages */ |
| 2166 | 2166 | $wgUseNPPatrol = true; |
| 2167 | 2167 | |
| | 2168 | +/** Provide syndication feeds (RSS, Atom) for eg REcentchanges, Newpages. */ |
| | 2169 | +$wgFeed = true; |
| | 2170 | + |
| 2168 | 2171 | /** Set maximum number of results to return in syndication feeds (RSS, Atom) for |
| 2169 | 2172 | * eg Recentchanges, Newpages. */ |
| 2170 | 2173 | $wgFeedLimit = 50; |
| Index: trunk/phase3/includes/PageHistory.php |
| — | — | @@ -483,7 +483,14 @@ |
| 484 | 484 | function feed( $type ) { |
| 485 | 485 | require_once 'SpecialRecentchanges.php'; |
| 486 | 486 | |
| 487 | | - global $wgFeedClasses; |
| | 487 | + global $wgFeed, $wgFeedClasses; |
| | 488 | + |
| | 489 | + if ( !$wgFeed ) { |
| | 490 | + global $wgOut; |
| | 491 | + $wgOut->addWikiMsg( 'feed-unavailable' ); |
| | 492 | + return; |
| | 493 | + } |
| | 494 | + |
| 488 | 495 | if( !isset( $wgFeedClasses[$type] ) ) { |
| 489 | 496 | global $wgOut; |
| 490 | 497 | $wgOut->addWikiMsg( 'feed-invalid' ); |
| Index: trunk/phase3/includes/QueryPage.php |
| — | — | @@ -448,7 +448,13 @@ |
| 449 | 449 | * Similar to above, but packaging in a syndicated feed instead of a web page |
| 450 | 450 | */ |
| 451 | 451 | function doFeed( $class = '', $limit = 50 ) { |
| 452 | | - global $wgFeedClasses; |
| | 452 | + global $wgFeed, $wgFeedClasses; |
| | 453 | + |
| | 454 | + if ( !$wgFeed ) { |
| | 455 | + global $wgOut; |
| | 456 | + $wgOut->addWikiMsg( 'feed-unavailable' ); |
| | 457 | + return; |
| | 458 | + } |
| 453 | 459 | |
| 454 | 460 | if( isset($wgFeedClasses[$class]) ) { |
| 455 | 461 | $feed = new $wgFeedClasses[$class]( |
| Index: trunk/phase3/languages/messages/MessagesEn.php |
| — | — | @@ -711,6 +711,7 @@ |
| 712 | 712 | 'restorelink' => '{{PLURAL:$1|one deleted edit|$1 deleted edits}}', |
| 713 | 713 | 'feedlinks' => 'Feed:', |
| 714 | 714 | 'feed-invalid' => 'Invalid subscription feed type.', |
| | 715 | +'feed-unavailable' => 'Syndication feeds are not available on {{SITENAME}}', |
| 715 | 716 | 'site-rss-feed' => '$1 RSS Feed', |
| 716 | 717 | 'site-atom-feed' => '$1 Atom Feed', |
| 717 | 718 | 'page-rss-feed' => '"$1" RSS Feed', |
| Index: trunk/phase3/RELEASE-NOTES |
| — | — | @@ -170,6 +170,7 @@ |
| 171 | 171 | confused when they are told they are range-blocked. |
| 172 | 172 | * Put "not yet written" in the title attribute of red links, so that readers |
| 173 | 173 | unfamiliar with the site might guess what the colour means. |
| | 174 | +* One can turn off syndicatino feeds by setting $wgFeed to false |
| 174 | 175 | |
| 175 | 176 | === Bug fixes in 1.12 === |
| 176 | 177 | |