r88056 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r88055‎ | r88056 | r88057 >
Date:12:24, 14 May 2011
Author:nikerabbit
Status:ok (Comments)
Tags:
Comment:
Special pages don't have talk page. Fixes exception in feeds when using revision deletion feature:

Exception: MWNamespace::getTalk does not make any sense for given namespace -1
Modified paths:
  • /trunk/phase3/includes/ChangesFeed.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/ChangesFeed.php
@@ -161,7 +161,7 @@
162162
163163 foreach( $sorted as $obj ) {
164164 $title = Title::makeTitle( $obj->rc_namespace, $obj->rc_title );
165 - $talkpage = $title->getTalkPage();
 165+ $talkpage = MWNamespace::canTalk( $obj->rc_namespace ) ? $title->getTalkPage()->getFullUrl() : '';
166166 // Skip items with deleted content (avoids partially complete/inconsistent output)
167167 if( $obj->rc_deleted ) continue;
168168 $item = new FeedItem(
@@ -170,7 +170,7 @@
171171 $obj->rc_this_oldid ? $title->getFullURL( 'diff=' . $obj->rc_this_oldid . '&oldid=prev' ) : $title->getFullURL(),
172172 $obj->rc_timestamp,
173173 ($obj->rc_deleted & Revision::DELETED_USER) ? wfMsgHtml('rev-deleted-user') : $obj->rc_user_text,
174 - $talkpage->getFullURL()
 174+ $talkpage
175175 );
176176 $feed->outItem( $item );
177177 }

Comments

#Comment by Hashar (talk | contribs)   12:27, 14 May 2011

This is exactly why I made it to throw an exception : to make better code. Thanks for fixing it NikeRabbit!


(this fix comes from a pair programming session between NikeRabbit & Hashar)

Status & tagging log