r44474 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r44473‎ | r44474 | r44475 >
Date:22:20, 11 December 2008
Author:brion
Status:ok
Tags:
Comment:
Throw in $wgEnableSerializedMessages which I can disable on test wikipedia so it'll now show up to date messages. Yay!
Modified paths:
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/languages/Language.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/DefaultSettings.php
@@ -853,6 +853,14 @@
854854 $wgMaxMsgCacheEntrySize = 10000;
855855
856856 /**
 857+ * If true, serialized versions of the messages arrays will be
 858+ * read from the 'serialized' subdirectory if they are present.
 859+ * Set to false to always use the Messages files, regardless of
 860+ * whether they are up to date or not.
 861+ */
 862+$wgEnableSerializedMessages = true;
 863+
 864+/**
857865 * Set to false if you are thorough system admin who always remembers to keep
858866 * serialized files up to date to save few mtime calls.
859867 */
Index: trunk/phase3/languages/Language.php
@@ -2272,7 +2272,7 @@
22732273 */
22742274 static function loadLocalisation( $code, $disableCache = false ) {
22752275 static $recursionGuard = array();
2276 - global $wgMemc, $wgCheckSerialized;
 2276+ global $wgMemc, $wgEnableSerializedMessages, $wgCheckSerialized;
22772277
22782278 if ( !$code ) {
22792279 throw new MWException( "Invalid language code requested" );
@@ -2287,16 +2287,18 @@
22882288 wfProfileIn( __METHOD__ );
22892289
22902290 # Try the serialized directory
2291 - $cache = wfGetPrecompiledData( self::getFileName( "Messages", $code, '.ser' ) );
2292 - if ( $cache ) {
2293 - if ( $wgCheckSerialized && self::isLocalisationOutOfDate( $cache ) ) {
2294 - $cache = false;
2295 - wfDebug( "Language::loadLocalisation(): precompiled data file for $code is out of date\n" );
2296 - } else {
2297 - self::$mLocalisationCache[$code] = $cache;
2298 - wfDebug( "Language::loadLocalisation(): got localisation for $code from precompiled data file\n" );
2299 - wfProfileOut( __METHOD__ );
2300 - return self::$mLocalisationCache[$code]['deps'];
 2291+ if( $wgEnableSerializedMessages ) {
 2292+ $cache = wfGetPrecompiledData( self::getFileName( "Messages", $code, '.ser' ) );
 2293+ if ( $cache ) {
 2294+ if ( $wgCheckSerialized && self::isLocalisationOutOfDate( $cache ) ) {
 2295+ $cache = false;
 2296+ wfDebug( "Language::loadLocalisation(): precompiled data file for $code is out of date\n" );
 2297+ } else {
 2298+ self::$mLocalisationCache[$code] = $cache;
 2299+ wfDebug( "Language::loadLocalisation(): got localisation for $code from precompiled data file\n" );
 2300+ wfProfileOut( __METHOD__ );
 2301+ return self::$mLocalisationCache[$code]['deps'];
 2302+ }
23012303 }
23022304 }
23032305

Status & tagging log