getLanguage(); $out = ''; foreach ( $this->getData( $languageCode ) as $key => $value ) { $out .= Xml::encodeJsCall( 'mw.config.set', array( $key, $value ) ); } return $out; } /** * Gets the last modified time for this module depending on the given * context. * * @param $context ResourceLoaderContext * @return int Unix timestamp */ public function getModifiedTime( ResourceLoaderContext $context ) { $languageCode = $context->getLanguage(); $cache = wfGetCache( CACHE_ANYTHING ); // Since we are updating the timestamp on hash change, we need to // cache the hash per language to avoid updating the timestamp when // different languages are being requested. $key = wfMemcKey( 'resourceloader', 'modulemodifiedhash', $this->getName(), $languageCode ); $data = $this->getData( $languageCode ); $hash = md5( serialize( $data ) ); $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; } }