MediaWiki r27983 - Code Review

Jump to: navigation, search
Repository:MediaWiki
Revision:r27982‎ | r27983 (on ViewVC)‎ | r27984 >
Date:17:03, 30 November 2007
Author:nikerabbit
Status:old
Tags:
Comment:
* (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)
Modified paths:

Diff [purge]

Index: trunk/phase3/includes/DefaultSettings.php
===================================================================
--- trunk/phase3/includes/DefaultSettings.php	(revision 27982)
+++ trunk/phase3/includes/DefaultSettings.php	(revision 27983)
@@ -806,6 +806,12 @@
  */
 $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;
 
Index: trunk/phase3/languages/Language.php
===================================================================
--- trunk/phase3/languages/Language.php	(revision 27982)
+++ trunk/phase3/languages/Language.php	(revision 27983)
@@ -1956,7 +1956,7 @@
 	 */
 	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 @@
 			# 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
Index: trunk/phase3/RELEASE-NOTES
===================================================================
--- trunk/phase3/RELEASE-NOTES	(revision 27982)
+++ trunk/phase3/RELEASE-NOTES	(revision 27983)
@@ -22,6 +22,9 @@
 * 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 @@
 * (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 ===
 

Status & tagging log

  • 15:22, 12 September 2011 Meno25 (Talk | contribs) changed the status of r27983 [removed: ok added: old]
Personal tools
Namespaces
Variants
Views
Actions
Site
Support
Download
Development
Communication
Toolbox