* (bug 8396) Ignore out-of-date serialised message caches
authorNiklas Laxström <nikerabbit@users.mediawiki.org>
Fri, 30 Nov 2007 17:03:12 +0000 (17:03 +0000)
committerNiklas Laxström <nikerabbit@users.mediawiki.org>
Fri, 30 Nov 2007 17:03:12 +0000 (17:03 +0000)
* 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
includes/DefaultSettings.php
languages/Language.php

index 4c38b60..4419cf5 100644 (file)
@@ -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 ===
 
index 56ae28b..b1ea6e5 100644 (file)
@@ -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;
 
index b2bf339..bb9d44e 100644 (file)
@@ -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