X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fresourceloader%2FResourceLoaderModule.php;h=b4a0f465c817ddb3328b8d5c1780b80707bb96ba;hp=ed2d09c8dc44660324d10f50b0cb65df314efcdc;hb=a65edcffc0cde2eb439138f6d66182df0c48fa46;hpb=eb70451cec6409526c8feaedf55700f51e10ffe7 diff --git a/includes/resourceloader/ResourceLoaderModule.php b/includes/resourceloader/ResourceLoaderModule.php index ed2d09c8dc..b4a0f465c8 100644 --- a/includes/resourceloader/ResourceLoaderModule.php +++ b/includes/resourceloader/ResourceLoaderModule.php @@ -1,7 +1,5 @@ getContentLanguage()->getDir() !== $context->getDirection(); } @@ -135,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(); @@ -145,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 ''; } @@ -689,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 ); @@ -758,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 ) ]; } }