// In-object cache for message blob mtime
protected $msgBlobMtime = array();
+ /**
+ * @var Config
+ */
+ protected $config;
+
/* Methods */
/**
return '';
}
+ /**
+ * @return Config
+ * @since 1.24
+ */
+ public function getConfig() {
+ if ( $this->config === null ) {
+ // Ugh, fall back to default
+ $this->config = ConfigFactory::getDefaultInstance()->makeConfig( 'main' );
+ }
+
+ return $this->config;
+ }
+
+ /**
+ * @param Config $config
+ * @since 1.24
+ */
+ public function setConfig( Config $config ) {
+ $this->config = $config;
+ }
+
/**
* Get the URL or URLs to load for this module's JS in debug mode.
* The default behavior is to return a load.php?only=scripts URL for
*
* @since 1.23
*
+ * @param ResourceLoaderContext $context
* @return int UNIX timestamp or 0 if no definition summary was provided
* by getDefinitionSummary()
*/
*
* @since 1.23
*
+ * @param ResourceLoaderContext $context
* @return array|null
*/
public function getDefinitionSummary( ResourceLoaderContext $context ) {
* @return string JS with the original, or a replacement error
*/
protected function validateScriptFile( $fileName, $contents ) {
- global $wgResourceLoaderValidateJS;
- if ( $wgResourceLoaderValidateJS ) {
+ if ( $this->getConfig()->get( 'ResourceLoaderValidateJS' ) ) {
// Try for cache hit
// Use CACHE_ANYTHING since filtering is very slow compared to DB queries
$key = wfMemcKey( 'resourceloader', 'jsparse', self::$parseCacheVersion, md5( $contents ) );