r111712 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111711‎ | r111712 | r111713 >
Date:01:48, 17 February 2012
Author:wikinaut
Status:deferred (Comments)
Tags:
Comment:
added ob_start() to prevent headers-already sent problem; add check for undefined variable; removed host wiki from the RSS feed title. feed title has now the programmatic form 'Pagename - Feed' which looks nice.
Modified paths:
  • /trunk/extensions/WikiArticleFeeds/WikiArticleFeeds.php (modified) (history)

Diff [purge]

Index: trunk/extensions/WikiArticleFeeds/WikiArticleFeeds.php
@@ -363,7 +363,8 @@
364364 global $wgWikiArticleFeedsSkipCache;
365365 if ( !$wgWikiArticleFeedsSkipCache && is_string( $cachedFeed ) ) {
366366 wfDebug( "WikiArticleFeedsExtension: Outputting cached feed\n" );
367 - $feed = new $wgFeedClasses[$feedFormat]( $wgSitename . ' - ' . $title->getText(), '', $title->getFullURL() );
 367+ $feed = new $wgFeedClasses[$feedFormat]( $title->getText(), '', $title->getFullURL(). " - Feed" );
 368+ ob_start();
368369 $feed->httpHeaders();
369370 echo $cachedFeed;
370371 } else {
@@ -373,7 +374,7 @@
374375 $cachedFeed = ob_get_contents();
375376 ob_end_flush();
376377
377 - $expire = 3600 * 24; # One day
 378+ $expire = 3600; # One hour
378379 $messageMemc->set( $key, $cachedFeed );
379380 $messageMemc->set( $timekey, wfTimestamp( TS_MW ), $expire );
380381 }
@@ -522,7 +523,7 @@
523524 $strippedSeg,
524525 $matches
525526 );
526 - if ( $matches[2] ) {
 527+ if ( !empty( $matches[2] ) ) {
527528 $url = $matches[2];
528529 if ( preg_match( '#^/#', $url ) ) {
529530 $url = $wgServer . $url;
@@ -539,7 +540,7 @@
540541 }
541542
542543 # Programmatically determine the feed title and id.
543 - $feedTitle = $wgSitename . ' - ' . $title->getPrefixedText();
 544+ $feedTitle = $title->getPrefixedText() . " - Feed";
544545 $feedId = $title->getFullUrl();
545546
546547 # Create feed

Follow-up revisions

RevisionCommit summaryAuthorDate
r111729* 0.671 added ob_start() to prevent headers-already sent problemwikinaut07:30, 17 February 2012
r111730follow-up r111729 . changed some empty() to \!isset(); refactored code commen...wikinaut07:43, 17 February 2012

Comments

#Comment by Nikerabbit (talk | contribs)   07:32, 17 February 2012

Use isset() if you only want to know whether the variable is set.

And the "Feed" should probably be localisable.

#Comment by Wikinaut (talk | contribs)   07:44, 17 February 2012

partially fixed in r111730

#Comment by Wikinaut (talk | contribs)   18:14, 18 February 2012

set to new

Status & tagging log