break;
// Single strings
case 'position':
- $this->isPositionDefined = true;
case 'group':
case 'skipFunction':
$this->{$member} = (string)$option;
$context
);
// Collect referenced files
- $this->saveFileDependencies( $context->getSkin(), $this->localFileRefs );
+ $this->saveFileDependencies( $context, $this->localFileRefs );
return $styles;
}
}
$files = array_map( array( $this, 'getLocalPath' ), $files );
// File deps need to be treated separately because they're already prefixed
- $files = array_merge( $files, $this->getFileDependencies( $context->getSkin() ) );
+ $files = array_merge( $files, $this->getFileDependencies( $context ) );
// Filter out any duplicates from getFileDependencies() and others.
// Most commonly introduced by compileLessFile(), which always includes the
// entry point Less file we already know about.
* @return array List of concatenated and remapped CSS data from $styles,
* keyed by media type
*
- * @since 1.26 Calling this method without a ResourceLoaderContext instance
+ * @since 1.27 Calling this method without a ResourceLoaderContext instance
* is deprecated.
*/
public function readStyleFiles( array $styles, $flip, $context = null ) {
if ( $context === null ) {
- wfDeprecated( __METHOD__ . ' without a ResourceLoader context', '1.26' );
+ wfDeprecated( __METHOD__ . ' without a ResourceLoader context', '1.27' );
$context = ResourceLoaderContext::newDummyContext();
}
$this->missingLocalFileRefs[] = $file;
}
}
- return CSSMin::remap(
- $style, $localDir, $remoteDir, true
- );
+ return MemoizedCallable::call( 'CSSMin::remap',
+ array( $style, $localDir, $remoteDir, true ) );
}
/**
* Keeps track of all used files and adds them to localFileRefs.
*
* @since 1.22
- * @since 1.26 Added $context paramter.
+ * @since 1.27 Added $context paramter.
* @throws Exception If less.php encounters a parse error
* @param string $fileName File path of LESS source
* @param ResourceLoaderContext $context Context in which to generate script
$vars = $this->getLessVars( $context );
ksort( $vars );
$varsHash = hash( 'md4', serialize( $vars ) );
- $cacheKey = wfGlobalCacheKey( 'LESS', $fileName, $varsHash );
+ $cacheKey = $cache->makeGlobalKey( 'LESS', $fileName, $varsHash );
$cachedCompile = $cache->get( $cacheKey );
// If we got a cached value, we have to validate it by getting a
if ( isset( $cachedCompile['hash'] ) ) {
$contentHash = FileContentsHasher::getFileContentsHash( $cachedCompile['files'] );
if ( $contentHash === $cachedCompile['hash'] ) {
- $this->localFileRefs += $cachedCompile['files'];
+ $this->localFileRefs = array_merge( $this->localFileRefs, $cachedCompile['files'] );
return $cachedCompile['css'];
}
}