X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fresourceloader%2FResourceLoader.php;h=15415816260a0545ff1bc5d6fade78dc2c93c492;hb=c108dd32d9b0e6bfa78ed2d94625aa0a036f2689;hp=c20d38642acaa8e7d02d3ab995c560641eea14df;hpb=1f0857f26f400e484041ba4c55eba6ddd934c5fe;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/resourceloader/ResourceLoader.php b/includes/resourceloader/ResourceLoader.php index c20d38642a..1541581626 100644 --- a/includes/resourceloader/ResourceLoader.php +++ b/includes/resourceloader/ResourceLoader.php @@ -1611,12 +1611,15 @@ MESSAGE; /** * Returns LESS compiler set up for use with MediaWiki * + * @since 1.22 + * @since 1.26 added $extraVars parameter * @param Config $config + * @param array $extraVars Associative array of extra (i.e., other than the + * globally-configured ones) that should be used for compilation. * @throws MWException - * @since 1.22 * @return Less_Parser */ - public static function getLessCompiler( Config $config ) { + public static function getLessCompiler( Config $config, $extraVars = array() ) { // When called from the installer, it is possible that a required PHP extension // is missing (at least for now; see bug 47564). If this is the case, throw an // exception (caught by the installer) to prevent a fatal error later on. @@ -1625,7 +1628,7 @@ MESSAGE; } $parser = new Less_Parser; - $parser->ModifyVars( self::getLessVars( $config ) ); + $parser->ModifyVars( array_merge( self::getLessVars( $config ), $extraVars ) ); $parser->SetImportDirs( array_fill_keys( $config->get( 'ResourceLoaderLESSImportPaths' ), '' ) ); $parser->SetOption( 'relativeUrls', false ); $parser->SetCacheDir( $config->get( 'CacheDirectory' ) ?: wfTempDir() ); @@ -1644,8 +1647,6 @@ MESSAGE; if ( !self::$lessVars ) { $lessVars = $config->get( 'ResourceLoaderLESSVars' ); Hooks::run( 'ResourceLoaderGetLessVars', array( &$lessVars ) ); - // Sort by key to ensure consistent hashing for cache lookups. - ksort( $lessVars ); self::$lessVars = $lessVars; } return self::$lessVars;