jenkins-bot has submitted this change and it was merged.
Change subject: Add {{NUMBEROFWIKIS}} variable to SiteMatrix
......................................................................
Add {{NUMBEROFWIKIS}} variable to SiteMatrix
Bug: T140479
Change-Id: Iff3b59a2b491f6998cdb5836754e9f501ef44c64
---
A SiteMatrix.i18n.magic.php
M SiteMatrix_body.php
M extension.json
3 files changed, 40 insertions(+), 1 deletion(-)
Approvals:
Legoktm: Looks good to me, approved
Jforrester: Looks good to me, but someone else must approve
jenkins-bot: Verified
diff --git a/SiteMatrix.i18n.magic.php b/SiteMatrix.i18n.magic.php
new file mode 100644
index 0000000..99289dc
--- /dev/null
+++ b/SiteMatrix.i18n.magic.php
@@ -0,0 +1,7 @@
+<?php
+
+$magicWords = array();
+
+$magicWords['en'] = array(
+ 'numberofwikis' => array( 0, 'numberofwikis' ),
+);
diff --git a/SiteMatrix_body.php b/SiteMatrix_body.php
index 6cfc73b..05b03ab 100644
--- a/SiteMatrix_body.php
+++ b/SiteMatrix_body.php
@@ -385,4 +385,29 @@
return true;
}
+
+ /**
+ * @param Parser $parser
+ * @param array $cache
+ * @param string $magicWordId
+ * @param string $ret
+ * @param PPFrame $frame
+ * @return bool true
+ */
+ public static function onParserGetVariableValueSwitch( Parser &$parser,
&$cache, &$magicWordId, &$ret, $frame = null ) {
+ if ( $magicWordId == 'numberofwikis' ) {
+ global $wgLocalDatabases;
+ $ret = count( $wgLocalDatabases );
+ }
+ return true;
+ }
+
+ /**
+ * @param array $customVariableIds
+ * @return bool true
+ */
+ public static function onMagicWordwgVariableIDs( &$customVariableIds ) {
+ $customVariableIds[] = 'numberofwikis';
+ return true;
+ }
}
diff --git a/extension.json b/extension.json
index 5453a00..a62643c 100644
--- a/extension.json
+++ b/extension.json
@@ -23,7 +23,8 @@
]
},
"ExtensionMessagesFiles": {
- "SiteMatrixAlias": "SiteMatrix.alias.php"
+ "SiteMatrixAlias": "SiteMatrix.alias.php",
+ "SiteMatrixMagic": "SiteMatrix.i18n.magic.php"
},
"AutoloadClasses": {
"SiteMatrix": "SiteMatrix_body.php",
@@ -33,6 +34,12 @@
"Hooks": {
"APIQuerySiteInfoGeneralInfo": [
"SiteMatrix::APIQuerySiteInfoGeneralInfo"
+ ],
+ "ParserGetVariableValueSwitch": [
+ "SiteMatrix::onParserGetVariableValueSwitch"
+ ],
+ "MagicWordwgVariableIDs": [
+ "SiteMatrix::onMagicWordwgVariableIDs"
]
},
"config": {
--
To view, visit https://gerrit.wikimedia.org/r/300024
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Iff3b59a2b491f6998cdb5836754e9f501ef44c64
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/SiteMatrix
Gerrit-Branch: master
Gerrit-Owner: Reedy <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Reedy <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits