Matmarex has uploaded a new change for review.
https://gerrit.wikimedia.org/r/76497
Change subject: mw.config: Deprecate wgMonthNames and wgMonthNamesShort
......................................................................
mw.config: Deprecate wgMonthNames and wgMonthNamesShort
Comments on whether we want it and whether this is the right way to do
it very welcome.
Change-Id: I40a66b6cd4e936bf4ac13cebea1d2c2ec12a0512
---
M includes/OutputPage.php
M includes/resourceloader/ResourceLoader.php
2 files changed, 22 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/97/76497/1
diff --git a/includes/OutputPage.php b/includes/OutputPage.php
index 83a7d3f..95bfb27 100644
--- a/includes/OutputPage.php
+++ b/includes/OutputPage.php
@@ -2772,7 +2772,10 @@
// Load config before anything else
$scripts .= Html::inlineScript(
ResourceLoader::makeLoaderConditionalScript(
- ResourceLoader::makeConfigSetScript(
$this->getJSVars() )
+ ResourceLoader::makeConfigSetScript(
$this->getJSVars() ) .
+ // Config deprecations
+ ResourceLoader::makeConfigDeprecateScript(
'wgMonthNames', 'Use mediawiki.language.months module instead.' ) .
+ ResourceLoader::makeConfigDeprecateScript(
'wgMonthNamesShort', 'Use mediawiki.language.months module instead.' )
)
);
diff --git a/includes/resourceloader/ResourceLoader.php
b/includes/resourceloader/ResourceLoader.php
index 1240abf..cb287f4 100644
--- a/includes/resourceloader/ResourceLoader.php
+++ b/includes/resourceloader/ResourceLoader.php
@@ -1066,6 +1066,24 @@
}
/**
+ * Returns JS code which will deprecate selected key in the MediaWiki
configuration (using
+ * mw.log.deprecate) array while leaving its value intact.
+ *
+ * @param string $key Configuration key, e.g. 'wgMonthNames'
+ * @param string $msg Additional message to be displayed (optional)
+ *
+ * @return string
+ */
+ public static function makeConfigDeprecateScript( $key, $msg = '' ) {
+ return Xml::encodeJsCall( 'mw.log.deprecate', array(
+ new XmlJsCode( 'mw.config.values' ),
+ $key,
+ new XmlJsCode( 'mw.config.values[' . Xml::encodeJsVar(
$key ) . ']' ),
+ $msg
+ ) );
+ }
+
+ /**
* Convert an array of module names to a packed query string.
*
* For example, array( 'foo.bar', 'foo.baz', 'bar.baz', 'bar.quux' )
--
To view, visit https://gerrit.wikimedia.org/r/76497
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I40a66b6cd4e936bf4ac13cebea1d2c2ec12a0512
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Matmarex <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits