break;
}
}
+ // Make sure the remote base path is a complete valid url
+ $this->remoteBasePath = wfExpandUrl( $this->remoteBasePath );
}
/**
* @return String: JavaScript code for $context
*/
public function getScript( ResourceLoaderContext $context ) {
- global $wgServer;
-
$files = array_merge(
$this->scripts,
self::tryForKey( $this->languageScripts, $context->getLanguage() ),
if ( $this->debugRaw ) {
$script = '';
foreach ( $files as $file ) {
- $path = $wgServer . $this->getRemotePath( $file );
+ $path = $this->getRemotePath( $file );
$script .= "\n\t" . Xml::encodeJsCall( 'mediaWiki.loader.load', array( $path ) );
}
return $script;
// If a module is nothing but a list of dependencies, we need to avoid
// giving max() an empty array
if ( count( $files ) === 0 ) {
+ wfProfileOut( __METHOD__ );
return $this->modifiedTime[$context->getHash()] = 1;
}
$this->modifiedTime[$context->getHash()] = max(
$filesMtime,
$this->getMsgBlobMtime( $context->getLanguage() ) );
+
wfProfileOut( __METHOD__ );
return $this->modifiedTime[$context->getHash()];
}
}
$styles = self::collateFilePathListByOption( $styles, 'media', 'all' );
foreach ( $styles as $media => $files ) {
+ $uniqueFiles = array_unique( $files );
$styles[$media] = implode(
"\n",
array_map(
array( $this, 'readStyleFile' ),
- array_unique( $files ),
- array( $flip )
+ $uniqueFiles,
+ array_fill( 0, count( $uniqueFiles ), $flip )
)
);
}