From fa669fe0344f7c74a744e331fccf5aa323755295 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Niklas=20Laxstr=C3=B6m?= Date: Fri, 30 Nov 2007 17:03:12 +0000 Subject: [PATCH] * (bug 8396) Ignore out-of-date serialised message caches * MediaWiki now checks if serialized files are out of date. New configuration variable $wgCheckSerialized can be set to false to enable old behavior (i.e. to not check and assume they are always up to date) --- RELEASE-NOTES | 4 ++++ includes/DefaultSettings.php | 6 ++++++ languages/Language.php | 15 ++++++++++----- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 4c38b60c7f..4419cf581d 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -22,6 +22,9 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * Marking edits as bot edits with Special:Contributions?bot=1 now requires the markbotedit permission, rather than the rollback permission previously used. This permission is assigned by default to the sysop group. +* MediaWiki now checks if serialized files are out of date. New configuration + variable $wgCheckSerialized can be set to false to enable old behavior (i.e. + to not check and assume they are always up to date) === New features in 1.12 === * (bug 10735) Add a warning for non-descriptive filenames at Special:Upload @@ -82,6 +85,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 9633) Add a predefined list of delete reasons to the deletion form * Show a warning message when creating/editing a user (talk) page but the user does not exists +* (bug 8396) Ignore out-of-date serialised message caches === Bug fixes in 1.12 === diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 56ae28bec2..b1ea6e5959 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -806,6 +806,12 @@ $wgMsgCacheExpiry = 86400; */ $wgMaxMsgCacheEntrySize = 10000; +/** + * Set to false if you are thorough system admin who always remembers to keep + * serialized files up to date to save few mtime calls. + */ +$wgCheckSerialized = true; + # Whether to enable language variant conversion. $wgDisableLangConversion = false; diff --git a/languages/Language.php b/languages/Language.php index b2bf339bd7..bb9d44e33e 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -1956,7 +1956,7 @@ class Language { */ static function loadLocalisation( $code, $disableCache = false ) { static $recursionGuard = array(); - global $wgMemc; + global $wgMemc, $wgCheckSerialized; if ( !$code ) { throw new MWException( "Invalid language code requested" ); @@ -1973,10 +1973,15 @@ class Language { # Try the serialized directory $cache = wfGetPrecompiledData( self::getFileName( "Messages", $code, '.ser' ) ); if ( $cache ) { - self::$mLocalisationCache[$code] = $cache; - wfDebug( "Language::loadLocalisation(): got localisation for $code from precompiled data file\n" ); - wfProfileOut( __METHOD__ ); - return self::$mLocalisationCache[$code]['deps']; + 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']; + } } # Try the global cache -- 2.20.1