Merge changes Ic13414f0,I26085bfc
[lhc/web/wiklou.git] / includes / resourceloader / ResourceLoaderLanguageDataModule.php
index e840300..fa0fbf8 100644 (file)
@@ -75,9 +75,10 @@ class ResourceLoaderLanguageDataModule extends ResourceLoaderModule {
                return $this->language->separatorTransformTable();
        }
 
-
        /**
-        * Get all the dynamic data for the content language to an array
+        * Get all the dynamic data for the content language to an array.
+        *
+        * NOTE: Before calling this you HAVE to make sure $this->language is set.
         *
         * @return array
         */
@@ -105,26 +106,20 @@ class ResourceLoaderLanguageDataModule extends ResourceLoaderModule {
 
        /**
         * @param $context ResourceLoaderContext
-        * @return array|int|Mixed
+        * @return int: UNIX timestamp
         */
        public function getModifiedTime( ResourceLoaderContext $context ) {
-               $this->language = Language::factory( $context->getLanguage() );
-               $cache = wfGetCache( CACHE_ANYTHING );
-               $key = wfMemcKey( 'resourceloader', 'langdatamodule', 'changeinfo' );
+               return max( 1, $this->getHashMtime( $context ) );
+       }
 
-               $data = $this->getData();
-               $hash = md5( serialize( $data ) );
+       /**
+        * @param $context ResourceLoaderContext
+        * @return string: Hash
+        */
+       public function getModifiedHash( ResourceLoaderContext $context ) {
+               $this->language = Language::factory( $context->getLanguage() );
 
-               $result = $cache->get( $key );
-               if ( is_array( $result ) && $result['hash'] === $hash ) {
-                       return $result['timestamp'];
-               }
-               $timestamp = wfTimestamp();
-               $cache->set( $key, array(
-                       'hash' => $hash,
-                       'timestamp' => $timestamp,
-               ) );
-               return $timestamp;
+               return md5( serialize( $this->getData() ) );
        }
 
        /**