X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fresourceloader%2FResourceLoaderModule.php;h=eca3a97396249c593e203caf9b7336f1db89b774;hb=328f50b982b7da8adf0104fe246cea6aae595ae3;hp=c9fd267d12ddc4cab9eb445e87ffe8298724c5ad;hpb=f66b93107594a4fc56e6cb86f32543fd153cdf40;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/resourceloader/ResourceLoaderModule.php b/includes/resourceloader/ResourceLoaderModule.php index c9fd267d12..eca3a97396 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 ''; }