* @param ResourceLoader $resourceLoader
* @param WebRequest $request
*/
- public function __construct( $resourceLoader, WebRequest $request ) {
- global $wgDefaultSkin, $wgResourceLoaderDebug;
-
+ public function __construct( ResourceLoader $resourceLoader, WebRequest $request ) {
$this->resourceLoader = $resourceLoader;
$this->request = $request;
// Various parameters
$this->skin = $request->getVal( 'skin' );
$this->user = $request->getVal( 'user' );
- $this->debug = $request->getFuzzyBool( 'debug', $wgResourceLoaderDebug );
+ $this->debug = $request->getFuzzyBool(
+ 'debug', $resourceLoader->getConfig()->get( 'ResourceLoaderDebug' )
+ );
$this->only = $request->getVal( 'only' );
$this->version = $request->getVal( 'version' );
$this->raw = $request->getFuzzyBool( 'raw' );
$skinnames = Skin::getSkinNames();
// If no skin is specified, or we don't recognize the skin, use the default skin
if ( !$this->skin || !isset( $skinnames[$this->skin] ) ) {
- $this->skin = $wgDefaultSkin;
+ $this->skin = $resourceLoader->getConfig()->get( 'DefaultSkin' );
}
}
* @return ResourceLoaderContext
*/
public static function newDummyContext() {
- return new self( null, new FauxRequest( array() ) );
+ return new self( new ResourceLoader, new FauxRequest( array() ) );
}
/**
* @return bool
*/
public function shouldIncludeScripts() {
- return is_null( $this->only ) || $this->only === 'scripts';
+ return is_null( $this->getOnly() ) || $this->getOnly() === 'scripts';
}
/**
* @return bool
*/
public function shouldIncludeStyles() {
- return is_null( $this->only ) || $this->only === 'styles';
+ return is_null( $this->getOnly() ) || $this->getOnly() === 'styles';
}
/**
* @return bool
*/
public function shouldIncludeMessages() {
- return is_null( $this->only ) || $this->only === 'messages';
+ return is_null( $this->getOnly() ) || $this->getOnly() === 'messages';
}
/**
public function getHash() {
if ( !isset( $this->hash ) ) {
$this->hash = implode( '|', array(
- $this->getLanguage(), $this->getDirection(), $this->skin, $this->user,
- $this->debug, $this->only, $this->version
+ $this->getLanguage(), $this->getDirection(), $this->getSkin(), $this->getUser(),
+ $this->getDebug(), $this->getOnly(), $this->getVersion()
) );
}
return $this->hash;