X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fresourceloader%2FResourceLoaderFileModule.php;h=42bd66a0e80d542f2d01dee78307b6505f568ef8;hb=1ed0a109ec00c3230da17713d438e1f5d275f7d1;hp=68ea0c07ab21eb159d76544f588bb4ee976e3a5a;hpb=ab5edd6ea23256969e38023cfa277778fca7b830;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/resourceloader/ResourceLoaderFileModule.php b/includes/resourceloader/ResourceLoaderFileModule.php index 68ea0c07ab..42bd66a0e8 100644 --- a/includes/resourceloader/ResourceLoaderFileModule.php +++ b/includes/resourceloader/ResourceLoaderFileModule.php @@ -153,10 +153,10 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { * * @param array $options List of options; if not given or empty, an empty module will be * constructed - * @param string $localBasePath Base path to prepend to all local paths in $options. Defaults - * to $IP - * @param string $remoteBasePath Base path to prepend to all remote paths in $options. Defaults - * to $wgResourceBasePath + * @param string|null $localBasePath Base path to prepend to all local paths in $options. + * Defaults to $IP + * @param string|null $remoteBasePath Base path to prepend to all remote paths in $options. + * Defaults to $wgResourceBasePath * * Below is a description for the $options array: * @throws InvalidArgumentException @@ -298,9 +298,9 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { * Implementation note: the amount of global state used in this function is staggering. * * @param array $options Module definition - * @param string $localBasePath Path to use if not provided in module definition. Defaults + * @param string|null $localBasePath Path to use if not provided in module definition. Defaults * to $IP - * @param string $remoteBasePath Path to use if not provided in module definition. Defaults + * @param string|null $remoteBasePath Path to use if not provided in module definition. Defaults * to $wgResourceBasePath * @return array Array( localBasePath, remoteBasePath ) */ @@ -460,9 +460,6 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { throw new MWException( __METHOD__ . ": skip function file not found: \"$localPath\"" ); } $contents = $this->stripBom( file_get_contents( $localPath ) ); - if ( $this->getConfig()->get( 'ResourceLoaderValidateStaticJS' ) ) { - $contents = $this->validateScriptFile( $localPath, $contents ); - } return $contents; } @@ -653,7 +650,7 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { * * @param array $list List of lists to select from * @param string $key Key to look for in $map - * @param string $fallback Key to look for in $list if $key doesn't exist + * @param string|null $fallback Key to look for in $list if $key doesn't exist * @return array List of elements from $map which matched $key or $fallback, * or an empty list in case of no match */ @@ -807,12 +804,6 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { throw new MWException( __METHOD__ . ": script file not found: \"$localPath\"" ); } $contents = $this->stripBom( file_get_contents( $localPath ) ); - if ( $this->getConfig()->get( 'ResourceLoaderValidateStaticJS' ) ) { - // Static files don't really need to be checked as often; unlike - // on-wiki module they shouldn't change unexpectedly without - // admin interference. - $contents = $this->validateScriptFile( $fileName, $contents ); - } $js .= $contents . "\n"; } return $js; @@ -826,7 +817,7 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { * @private * @param array $styles Map of media type to file paths to read, remap, and concatenate * @param bool $flip - * @param ResourceLoaderContext $context + * @param ResourceLoaderContext|null $context * @return array List of concatenated and remapped CSS data from $styles, * keyed by media type * @throws MWException @@ -959,10 +950,7 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { $cache = ObjectCache::getLocalServerInstance( CACHE_ANYTHING ); } - $vars = array_merge( - $context->getResourceLoader()->getLessVars(), - $this->getLessVars( $context ) - ); + $vars = $this->getLessVars( $context ); // Construct a cache key from the LESS file name, and a hash digest // of the LESS variables used for compilation. ksort( $vars );