From 370d700dd6c62ce1ee25f0c1b2d9d069d6cf3125 Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Fri, 11 Feb 2011 08:07:47 +0000 Subject: [PATCH] Fix getMsgBlobMtime() to also cause a cache invalidation if a module has messages but no stored message blob --- includes/resourceloader/ResourceLoaderModule.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/includes/resourceloader/ResourceLoaderModule.php b/includes/resourceloader/ResourceLoaderModule.php index dd4fc0e0e7..f8ed3d23c1 100644 --- a/includes/resourceloader/ResourceLoaderModule.php +++ b/includes/resourceloader/ResourceLoaderModule.php @@ -229,7 +229,7 @@ abstract class ResourceLoaderModule { * Get the last modification timestamp of the message blob for this * module in a given language. * @param $lang String: Language code - * @return Integer: UNIX timestamp, or 0 if no blob found + * @return Integer: UNIX timestamp, or 0 if the module doesn't have messages */ public function getMsgBlobMtime( $lang ) { if ( !isset( $this->msgBlobMtime[$lang] ) ) { @@ -242,7 +242,12 @@ abstract class ResourceLoaderModule { 'mr_lang' => $lang ), __METHOD__ ); - $this->msgBlobMtime[$lang] = $msgBlobMtime ? wfTimestamp( TS_UNIX, $msgBlobMtime ) : 0; + // If no blob was found, but the module does have messages, that means we need + // to regenerate it. Return NOW + if ( !$msgBlobMtime ) { + $msgBlobMtime = wfTimestamp( TS_UNIX ); + } + $this->msgBlobMtime[$lang] = wfTimestamp( TS_UNIX, $msgBlobMtime ); } return $this->msgBlobMtime[$lang]; } -- 2.20.1