r43398 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r43397‎ | r43398 | r43399 >
Date:23:26, 11 November 2008
Author:tstarling
Status:old
Tags:
Comment:
Language object cache, for faster wfMsg() performance with unusual languages, and hopefully less memory. Committing for test on server.
Modified paths:
  • /trunk/phase3/languages/Language.php (modified) (history)

Diff [purge]

Index: trunk/phase3/languages/Language.php
@@ -74,6 +74,7 @@
7575 static public $mMergeableAliasListKeys = array( 'specialPageAliases' );
7676
7777 static public $mLocalisationCache = array();
 78+ static public $mLangObjCache = array();
7879
7980 static public $mWeekdayMsgs = array(
8081 'sunday', 'monday', 'tuesday', 'wednesday', 'thursday',
@@ -130,12 +131,16 @@
131132 );
132133
133134 /**
134 - * Create a language object for a given language code
 135+ * Get a language object for a given language code
135136 */
136137 static function factory( $code ) {
137138 global $IP;
138139 static $recursionLevel = 0;
139140
 141+ if ( isset( self::$mLangObjCache[$code] ) ) {
 142+ return self::$mLangObjCache[$code];
 143+ }
 144+
140145 if ( $code == 'en' ) {
141146 $class = 'Language';
142147 } else {
@@ -163,6 +168,7 @@
164169 $lang = new $class;
165170 }
166171
 172+ self::$mLangObjCache[$code] = $lang;
167173 return $lang;
168174 }
169175

Follow-up revisions

RevisionCommit summaryAuthorDate
r43399Fixed fallback feature broken by r43398.tstarling00:11, 12 November 2008

Status & tagging log