From 432372fd4677252bee35a8ba946db6a379d88dfa Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Thu, 11 Dec 2008 22:20:26 +0000 Subject: [PATCH] Throw in $wgEnableSerializedMessages which I can disable on test wikipedia so it'll now show up to date messages. Yay! --- includes/DefaultSettings.php | 8 ++++++++ languages/Language.php | 24 +++++++++++++----------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index bdaad8330b..8379bac4a7 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -852,6 +852,14 @@ $wgMsgCacheExpiry = 86400; */ $wgMaxMsgCacheEntrySize = 10000; +/** + * If true, serialized versions of the messages arrays will be + * read from the 'serialized' subdirectory if they are present. + * Set to false to always use the Messages files, regardless of + * whether they are up to date or not. + */ +$wgEnableSerializedMessages = true; + /** * Set to false if you are thorough system admin who always remembers to keep * serialized files up to date to save few mtime calls. diff --git a/languages/Language.php b/languages/Language.php index 49a37ea1a1..5aa1650da6 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -2272,7 +2272,7 @@ class Language { */ static function loadLocalisation( $code, $disableCache = false ) { static $recursionGuard = array(); - global $wgMemc, $wgCheckSerialized; + global $wgMemc, $wgEnableSerializedMessages, $wgCheckSerialized; if ( !$code ) { throw new MWException( "Invalid language code requested" ); @@ -2287,16 +2287,18 @@ class Language { wfProfileIn( __METHOD__ ); # Try the serialized directory - $cache = wfGetPrecompiledData( self::getFileName( "Messages", $code, '.ser' ) ); - if ( $cache ) { - if ( $wgCheckSerialized && self::isLocalisationOutOfDate( $cache ) ) { - $cache = false; - wfDebug( "Language::loadLocalisation(): precompiled data file for $code is out of date\n" ); - } else { - self::$mLocalisationCache[$code] = $cache; - wfDebug( "Language::loadLocalisation(): got localisation for $code from precompiled data file\n" ); - wfProfileOut( __METHOD__ ); - return self::$mLocalisationCache[$code]['deps']; + if( $wgEnableSerializedMessages ) { + $cache = wfGetPrecompiledData( self::getFileName( "Messages", $code, '.ser' ) ); + if ( $cache ) { + if ( $wgCheckSerialized && self::isLocalisationOutOfDate( $cache ) ) { + $cache = false; + wfDebug( "Language::loadLocalisation(): precompiled data file for $code is out of date\n" ); + } else { + self::$mLocalisationCache[$code] = $cache; + wfDebug( "Language::loadLocalisation(): got localisation for $code from precompiled data file\n" ); + wfProfileOut( __METHOD__ ); + return self::$mLocalisationCache[$code]['deps']; + } } } -- 2.20.1