X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Fresourceloader%2FResourceLoaderModule.php;h=48e7937104cef639aa694bb21279059d7ecc5344;hb=3cfcd55011244c0767079bf4dbeb0dcc2345d34c;hp=59f9a6370cfe382a0f37092381839596a6d1bafc;hpb=5c1b3768ed022978edb038df14e0f15874eea7b4;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/resourceloader/ResourceLoaderModule.php b/includes/resourceloader/ResourceLoaderModule.php index 59f9a6370c..48e7937104 100644 --- a/includes/resourceloader/ResourceLoaderModule.php +++ b/includes/resourceloader/ResourceLoaderModule.php @@ -82,6 +82,11 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface { */ protected $config; + /** + * @var array|bool + */ + protected $deprecated = false; + /** * @var LoggerInterface */ @@ -130,6 +135,28 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface { return $wgContLang->getDir() !== $context->getDirection(); } + /** + * Get JS representing deprecation information for the current module if available + * + * @return string JavaScript code + */ + protected function getDeprecationInformation() { + $deprecationInfo = $this->deprecated; + if ( $deprecationInfo ) { + $name = $this->getName(); + $warning = 'This page is using the deprecated ResourceLoader module "' . $name . '".'; + if ( !is_bool( $deprecationInfo ) && isset( $deprecationInfo['message'] ) ) { + $warning .= "\n" . $deprecationInfo['message']; + } + return Xml::encodeJsCall( + 'mw.log.warn', + [ $warning ] + ); + } else { + return ''; + } + } + /** * Get all JS for this module for a given language and skin. * Includes all relevant JS except loader scripts.