X-Git-Url: https://git.cyclocoop.org/%20%27.%28%24debut%20%20%20%24par_page%29.%27?a=blobdiff_plain;f=includes%2Fresourceloader%2FResourceLoaderModule.php;h=b4a0f465c817ddb3328b8d5c1780b80707bb96ba;hb=a65edcffc0cde2eb439138f6d66182df0c48fa46;hp=c9fd267d12ddc4cab9eb445e87ffe8298724c5ad;hpb=60882bb6b07aa0a9cbf0f8a2224cc94e2575dc11;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/resourceloader/ResourceLoaderModule.php b/includes/resourceloader/ResourceLoaderModule.php index c9fd267d12..b4a0f465c8 100644 --- a/includes/resourceloader/ResourceLoaderModule.php +++ b/includes/resourceloader/ResourceLoaderModule.php @@ -128,7 +128,7 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface { * @param ResourceLoaderContext $context * @return bool */ - public function getFlip( $context ) { + public function getFlip( ResourceLoaderContext $context ) { return MediaWikiServices::getInstance()->getContentLanguage()->getDir() !== $context->getDirection(); } @@ -136,9 +136,13 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface { /** * Get JS representing deprecation information for the current module if available * + * @param ResourceLoaderContext|null $context Missing $context is deprecated in 1.34 * @return string JavaScript code */ - public function getDeprecationInformation() { + public function getDeprecationInformation( ResourceLoaderContext $context = null ) { + if ( $context === null ) { + wfDeprecated( __METHOD__ . ' without a ResourceLoader context', '1.34' ); + } $deprecationInfo = $this->deprecated; if ( $deprecationInfo ) { $name = $this->getName(); @@ -146,7 +150,10 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface { if ( is_string( $deprecationInfo ) ) { $warning .= "\n" . $deprecationInfo; } - return 'mw.log.warn(' . ResourceLoader::encodeJsonForScript( $warning ) . ');'; + if ( $context === null ) { + return 'mw.log.warn(' . ResourceLoader::encodeJsonForScript( $warning ) . ');'; + } + return 'mw.log.warn(' . $context->encodeJson( $warning ) . ');'; } else { return ''; } @@ -690,7 +697,6 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface { * @return array */ final protected function buildContent( ResourceLoaderContext $context ) { - $rl = $context->getResourceLoader(); $stats = MediaWikiServices::getInstance()->getStatsdDataFactory(); $statStart = microtime( true ); @@ -759,7 +765,7 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface { } // Wrap styles into @media groups as needed and flatten into a numerical array $styles = [ - 'css' => $rl->makeCombinedStyles( $stylePairs ) + 'css' => ResourceLoader::makeCombinedStyles( $stylePairs ) ]; } }