From 4ac9fa081a7c045f6a9f1cfc529d82423f485b2e Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sun, 8 Dec 2013 09:55:49 +0100 Subject: Update to MediaWiki 1.22.0 --- .../ResourceLoaderLanguageDataModule.php | 31 +++++++++------------- 1 file changed, 13 insertions(+), 18 deletions(-) (limited to 'includes/resourceloader/ResourceLoaderLanguageDataModule.php') diff --git a/includes/resourceloader/ResourceLoaderLanguageDataModule.php b/includes/resourceloader/ResourceLoaderLanguageDataModule.php index 0f8e54ce..fa0fbf85 100644 --- a/includes/resourceloader/ResourceLoaderLanguageDataModule.php +++ b/includes/resourceloader/ResourceLoaderLanguageDataModule.php @@ -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() ) ); } /** -- cgit v1.2.3-54-g00ecf