* @return string Filtered data, or a comment containing an error message
*/
public function filter( $filter, $data, $cacheReport = true ) {
- wfProfileIn( __METHOD__ );
// For empty/whitespace-only data or for unknown filters, don't perform
// any caching or processing
if ( trim( $data ) === '' || !in_array( $filter, array( 'minify-js', 'minify-css' ) ) ) {
- wfProfileOut( __METHOD__ );
return $data;
}
$cacheEntry = $cache->get( $key );
if ( is_string( $cacheEntry ) ) {
wfIncrStats( "rl-$filter-cache-hits" );
- wfProfileOut( __METHOD__ );
return $cacheEntry;
}
$this->errors[] = self::formatExceptionNoComment( $e );
}
- wfProfileOut( __METHOD__ );
-
return $result;
}
public function __construct( Config $config = null ) {
global $IP;
- wfProfileIn( __METHOD__ );
-
if ( $config === null ) {
wfDebug( __METHOD__ . ' was called without providing a Config instance' );
$config = ConfigFactory::getDefaultInstance()->makeConfig( 'main' );
$this->registerTestModules();
}
- wfProfileOut( __METHOD__ );
}
/**
* not registered
*/
public function register( $name, $info = null ) {
- wfProfileIn( __METHOD__ );
// Allow multiple modules to be registered in one call
$registrations = is_array( $name ) ? $name : array( $name => $info );
foreach ( $registrations as $name => $info ) {
// Disallow duplicate registrations
if ( isset( $this->moduleInfos[$name] ) ) {
- wfProfileOut( __METHOD__ );
// A module has already been registered by this name
throw new MWException(
'ResourceLoader duplicate registration error. ' .
// Check $name for validity
if ( !self::isValidModuleName( $name ) ) {
- wfProfileOut( __METHOD__ );
throw new MWException( "ResourceLoader module name '$name' is invalid, "
. "see ResourceLoader::isValidModuleName()" );
}
// New calling convention
$this->moduleInfos[$name] = $info;
} else {
- wfProfileOut( __METHOD__ );
throw new MWException(
'ResourceLoader module info type error for module \'' . $name .
'\': expected ResourceLoaderModule or array (got: ' . gettype( $info ) . ')'
}
}
- wfProfileOut( __METHOD__ );
}
/**
. 'Edit your <code>LocalSettings.php</code> to enable it.' );
}
- wfProfileIn( __METHOD__ );
-
// Get core test suites
$testModules = array();
$testModules['qunit'] = array();
$this->testModuleNames[$id] = array_keys( $testModules[$id] );
}
- wfProfileOut( __METHOD__ );
}
/**
// See http://bugs.php.net/bug.php?id=36514
ob_start();
- wfProfileIn( __METHOD__ );
-
// Find out which modules are missing and instantiate the others
$modules = array();
$missing = array();
$this->errors[] = self::formatExceptionNoComment( $e );
}
- wfProfileIn( __METHOD__ . '-getModifiedTime' );
-
// To send Last-Modified and support If-Modified-Since, we need to detect
// the last modified time
$mtime = wfTimestamp( TS_UNIX, $this->config->get( 'CacheEpoch' ) );
}
}
- wfProfileOut( __METHOD__ . '-getModifiedTime' );
-
// If there's an If-Modified-Since header, respond with a 304 appropriately
if ( $this->tryRespondLastModified( $context, $mtime ) ) {
- wfProfileOut( __METHOD__ );
return; // output handled (buffers cleared)
}
$this->errors = array();
echo $response;
- wfProfileOut( __METHOD__ );
}
/**
no modules were requested. Max made me put this here. */";
}
- wfProfileIn( __METHOD__ );
-
$image = $context->getImageObj();
if ( $image ) {
$data = $image->getImageData( $context );
$data = '';
$this->errors[] = 'Image generation failed';
}
- wfProfileOut( __METHOD__ );
return $data;
}
* @var $module ResourceLoaderModule
*/
- wfProfileIn( __METHOD__ . '-' . $name );
try {
$scripts = '';
if ( $context->shouldIncludeScripts() ) {
unset( $modules[$name] );
}
$isRaw |= $module->isRaw();
- wfProfileOut( __METHOD__ . '-' . $name );
}
// Update module states
}
}
- wfProfileOut( __METHOD__ );
return $out;
}