r94566 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r94565‎ | r94566 | r94567 >
Date:21:01, 15 August 2011
Author:preilly
Status:resolved (Comments)
Tags:
Comment:
fix for fatal error caused by call to isMainPage
Modified paths:
  • /trunk/extensions/MobileFrontend/MobileFrontend.php (modified) (history)

Diff [purge]

Index: trunk/extensions/MobileFrontend/MobileFrontend.php
@@ -181,7 +181,7 @@
182182 // The title
183183 self::$title = $out->getTitle();
184184
185 - if ( $out->getTitle()->isMainPage() ) {
 185+ if ( Title::newMainPage()->getArticleId() === self::$title->getArticleId() ) {
186186 self::$isMainPage = true;
187187 }
188188

Follow-up revisions

RevisionCommit summaryAuthorDate
r94567mft r94566preilly21:01, 15 August 2011
r94662fix for r94566preilly17:13, 16 August 2011

Comments

#Comment by Nikerabbit (talk | contribs)   11:25, 16 August 2011

What was the error? The replacement looks wrong and inefficient?

#Comment by Catrope (talk | contribs)   11:43, 16 August 2011

Title::isMainPage() is not available in 1.17wmf1, which caused a fatal error when we deployed the code to testwiki.

Yes, this is inefficient and wrong (false positive if both the main page and self::$title don't exist). What you want is Title::newMainPage()->equals( self::$title )

#Comment by Preilly (talk | contribs)   17:13, 16 August 2011

This should be corrected now in r94566.

#Comment by Preilly (talk | contribs)   17:14, 16 August 2011

Actually this is fixed correctly now in r94662.

Status & tagging log