r97815 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r97814‎ | r97815 | r97816 >
Date:14:04, 22 September 2011
Author:nikerabbit
Status:ok (Comments)
Tags:
Comment:
Don't load all languages just to check whether message is known.
I'm pretty sure I already fixed this once in the past.
Modified paths:
  • /trunk/phase3/includes/Title.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Title.php
@@ -3952,7 +3952,7 @@
39533953 return $this->mDbkeyform == '';
39543954 case NS_MEDIAWIKI:
39553955 // known system message
3956 - return $this->getDefaultMessageText() !== false;
 3956+ return $this->hasSourceText() !== false;
39573957 default:
39583958 return false;
39593959 }
@@ -3982,8 +3982,13 @@
39833983
39843984 if ( $this->mNamespace == NS_MEDIAWIKI ) {
39853985 // If the page doesn't exist but is a known system message, default
3986 - // message content will be displayed, same for language subpages
3987 - return $this->getDefaultMessageText() !== false;
 3986+ // message content will be displayed, same for language subpages-
 3987+ // Use always content language to avoid loading hundreds of languages
 3988+ // to get the link color.
 3989+ global $wgContLang;
 3990+ list( $name, $lang ) = MessageCache::singleton()->figureMessage( $wgContLang->lcfirst( $this->getText() ) );
 3991+ $message = wfMessage( $name )->inLanguage( $wgContLang )->useDatabase( false );
 3992+ return $message->exists();
39883993 }
39893994
39903995 return false;

Sign-offs

UserFlagDate
Hasharinspected16:40, 17 October 2011

Follow-up revisions

RevisionCommit summaryAuthorDate
r100746REL1_18 MFT r97815, r98069, r98210, r98212, 98298reedy21:33, 25 October 2011
r102055MFT r97815 to fix bug 31627aaron21:47, 4 November 2011

Comments

#Comment by Hashar (talk | contribs)   16:40, 17 October 2011

This one probably need a backport to 1.18 as it seems to fix a possible performance bottleneck.

#Comment by Aaron Schulz (talk | contribs)   21:39, 4 November 2011

The MessageCache class really needs docs.

Status & tagging log