* to $IP
* @param string $remoteBasePath Path to use if not provided in module definition. Defaults
* to $wgScriptPath
- * @return array array( localBasePath, remoteBasePath )
+ * @return array Array( localBasePath, remoteBasePath )
*/
public static function extractBasePaths(
$options = array(),
// but were preserved for backwards-compatibility just in case. Tread lightly.
$localBasePath = $localBasePath === null ? $IP : $localBasePath;
- if ( $remoteBasePath !== null ) {
- $remoteBasePath = $remoteBasePath;
- } else {
+ if ( $remoteBasePath === null ) {
$remoteBasePath = $wgResourceBasePath === null ? $wgScriptPath : $wgResourceBasePath;
}
return null;
}
- global $wgResourceLoaderValidateStaticJS;
$localPath = $this->getLocalPath( $this->skipFunction );
if ( !file_exists( $localPath ) ) {
throw new MWException( __METHOD__ . ": skip function file not found: \"$localPath\"" );
}
$contents = file_get_contents( $localPath );
- if ( $wgResourceLoaderValidateStaticJS ) {
- $contents = $this->validateScriptFile( $fileName, $contents );
+ if ( $this->getConfig()->get( 'ResourceLoaderValidateStaticJS' ) ) {
+ $contents = $this->validateScriptFile( $localPath, $contents );
}
return $contents;
}
* @return string Concatenated and remapped JavaScript data from $scripts
*/
protected function readScriptFiles( array $scripts ) {
- global $wgResourceLoaderValidateStaticJS;
if ( empty( $scripts ) ) {
return '';
}
throw new MWException( __METHOD__ . ": script file not found: \"$localPath\"" );
}
$contents = file_get_contents( $localPath );
- if ( $wgResourceLoaderValidateStaticJS ) {
+ 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.
* @param string $fileName File name of root LESS file.
* @return string Cache key
*/
- protected static function getLESSCacheKey( $fileName ) {
- $vars = json_encode( ResourceLoader::getLESSVars() );
+ protected function getLESSCacheKey( $fileName ) {
+ $vars = json_encode( ResourceLoader::getLESSVars( $this->getConfig() ) );
$hash = md5( $fileName . $vars );
return wfMemcKey( 'resourceloader', 'less', $hash );
}
* @return string CSS source
*/
protected function compileLESSFile( $fileName ) {
- $key = self::getLESSCacheKey( $fileName );
+ $key = $this->getLESSCacheKey( $fileName );
$cache = wfGetCache( CACHE_ANYTHING );
// The input to lessc. Either an associative array representing the
$source = $fileName;
}
- $compiler = ResourceLoader::getLessCompiler();
+ $compiler = ResourceLoader::getLessCompiler( $this->getConfig() );
$result = null;
$result = $compiler->cachedCompile( $source );