Fix getMsgBlobMtime() to also cause a cache invalidation if a module has messages...
authorRoan Kattouw <catrope@users.mediawiki.org>
Fri, 11 Feb 2011 08:07:47 +0000 (08:07 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Fri, 11 Feb 2011 08:07:47 +0000 (08:07 +0000)
includes/resourceloader/ResourceLoaderModule.php

index dd4fc0e..f8ed3d2 100644 (file)
@@ -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];
        }