<?php
/**
- * Resource loader module based on local JavaScript/CSS files.
+ * ResourceLoader module based on local JavaScript/CSS files.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*/
protected $debugScripts = array();
- /**
- * @var array List of paths to JavaScript files to include in the startup module
- * @par Usage:
- * @code
- * array( [file-path], [file-path], ... )
- * @endcode
- */
- protected $loaderScripts = array();
-
/**
* @var array List of paths to CSS files to always include
* @par Usage:
* ),
* // Scripts to include in debug contexts
* 'debugScripts' => [file path string or array of file path strings],
- * // Scripts to include in the startup module
- * 'loaderScripts' => [file path string or array of file path strings],
* // Modules which must be loaded before this module
* 'dependencies' => [module name string or array of module name strings],
* 'templates' => array(
// Lists of file paths
case 'scripts':
case 'debugScripts':
- case 'loaderScripts':
case 'styles':
$this->{$member} = (array)$option;
break;
break;
// Single strings
case 'position':
- $this->isPositionDefined = true;
case 'group':
case 'skipFunction':
$this->{$member} = (string)$option;
return $this->debugRaw;
}
- /**
- * Get loader script.
- *
- * @return string|bool JavaScript code to be added to startup module
- */
- public function getLoaderScript() {
- if ( count( $this->loaderScripts ) === 0 ) {
- return false;
- }
- return $this->readScriptFiles( $this->loaderScripts );
- }
-
/**
* Get all styles for a given context.
*
$this->templates,
$context->getDebug() ? $this->debugScripts : array(),
$this->getLanguageScripts( $context->getLanguage() ),
- self::tryForKey( $this->skinScripts, $context->getSkin(), 'default' ),
- $this->loaderScripts
+ self::tryForKey( $this->skinScripts, $context->getSkin(), 'default' )
);
if ( $this->skipFunction ) {
$files[] = $this->skipFunction;
// - position (only used by OutputPage)
'scripts',
'debugScripts',
- 'loaderScripts',
'styles',
'languageScripts',
'skinScripts',
* @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
static $cache;
if ( !$cache ) {
- $cache = ObjectCache::newAccelerator( CACHE_ANYTHING );
+ $cache = ObjectCache::getLocalServerInstance( CACHE_ANYTHING );
}
// Construct a cache key from the LESS file name and a hash digest
$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