X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fresourceloader%2FResourceLoader.php;h=b05b51b7fb00987b38962562b7913afbaa3db32f;hb=34fe90ac52644c3a543ca8adf89900c0fb2de70b;hp=34a0a99d31b8359b9fee56c1f50f63b80a454f7b;hpb=75d8b6c6cd2b70d98242e1246678c12e973a5dfa;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/resourceloader/ResourceLoader.php b/includes/resourceloader/ResourceLoader.php index 34a0a99d31..b05b51b7fb 100644 --- a/includes/resourceloader/ResourceLoader.php +++ b/includes/resourceloader/ResourceLoader.php @@ -388,7 +388,6 @@ class ResourceLoader implements LoggerAwareInterface { } } } - } /** @@ -428,7 +427,6 @@ class ResourceLoader implements LoggerAwareInterface { // Keep track of their names so that they can be loaded together $this->testModuleNames[$id] = array_keys( $testModules[$id] ); } - } /** @@ -779,7 +777,6 @@ class ResourceLoader implements LoggerAwareInterface { $this->errors = []; echo $response; - } /** @@ -1009,6 +1006,7 @@ MESSAGE; foreach ( $modules as $name => $module ) { try { $content = $module->getModuleContent( $context ); + $implementKey = $name . '@' . $module->getVersionHash( $context ); $strContent = ''; // Append output @@ -1020,7 +1018,7 @@ MESSAGE; $strContent = $scripts; } elseif ( is_array( $scripts ) ) { // ...except when $scripts is an array of URLs - $strContent = self::makeLoaderImplementScript( $name, $scripts, [], [], [] ); + $strContent = self::makeLoaderImplementScript( $implementKey, $scripts, [], [], [] ); } break; case 'styles': @@ -1046,7 +1044,7 @@ MESSAGE; } } $strContent = self::makeLoaderImplementScript( - $name, + $implementKey, $scripts, isset( $content['styles'] ) ? $content['styles'] : [], isset( $content['messagesBlob'] ) ? new XmlJsCode( $content['messagesBlob'] ) : [], @@ -1125,7 +1123,7 @@ MESSAGE; /** * Return JS code that calls mw.loader.implement with given module properties. * - * @param string $name Module name + * @param string $name Module name or implement key (format "`[name]@[version]`") * @param XmlJsCode|array|string $scripts Code as XmlJsCode (to be wrapped in a closure), * list of URLs to JavaScript files, or a string of JavaScript for `$.globalEval`. * @param mixed $styles Array of CSS strings keyed by media type, or an array of lists of URLs @@ -1141,7 +1139,6 @@ MESSAGE; protected static function makeLoaderImplementScript( $name, $scripts, $styles, $messages, $templates ) { - if ( $scripts instanceof XmlJsCode ) { $scripts = new XmlJsCode( "function ( $, jQuery, require, module ) {\n{$scripts->value}\n}" ); } elseif ( !is_string( $scripts ) && !is_array( $scripts ) ) {