Page MenuHomePhabricator

Add SiteMatrix to PatchDemo
Open, Needs TriagePublicFeature

Description

Repository link: https://gerrit.wikimedia.org/g/mediawiki/extensions/SiteMatrix

In a wiki farm environment each wiki should be added to $wgSiteMatrixSites[] so that Special:SiteMatrix and action=sitematrix can be used to interrogate the farm.

Related:

Event Timeline

bd808 changed the subtype of this task from "Task" to "Feature Request".Dec 15 2025, 3:28 PM
bd808 updated the task description. (Show Details)

In a wiki farm environment each wiki should be added to $wgSiteMatrixSites[] so that Special:SiteMatrix and action=sitematrix can be used to interrogate the farm.

Ouch. It looks like this task will take more than 20 minutes that I hoped for.

@bd808, pay attention, please, that the $wgSiteMatrixSites[] array format in Wikimedia is very different from the given in mw:Extension:SiteMatrix#Configuration, and there will be a need of "url" field, and a need of "dir" field, as a closest ancestor of "url" that has such a field. The most simple structure could be even, I think, something like:

[
	"0": {
		"name": "wiki",
		"url": "http://abcde.catalyst.wmcloud.org",
		"lang": "en",
		"dir": "ltr"
	},
	"1": {
		"name": "wiki2",
		"url": "http://abcde.catalyst.wmcloud.org/wiki2",
		"lang": "en",
		"dir": "ltr"
	}
]

Actually, one lang and one dir could be enough, but I hope one day different wikis could get different languages code, as you said earlier. Thank you.

A_smart_kitten subscribed.

(removing the MediaWiki-extensions-GlobalWatchlist tag, as AFAICS this task doesn't involve GlobalWatchlist code itself. please correct me if I am wrong!)

@bd808, pay attention, please, that the $wgSiteMatrixSites[] array format in Wikimedia is very different from the given in mw:Extension:SiteMatrix#Configuration, and there will be a need of "url" field, and a need of "dir" field, as a closest ancestor of "url" that has such a field. The most simple structure could be even, I think, something like:

[
	"0": {
		"name": "wiki",
		"url": "http://abcde.catalyst.wmcloud.org",
		"lang": "en",
		"dir": "ltr"
	},
	"1": {
		"name": "wiki2",
		"url": "http://abcde.catalyst.wmcloud.org/wiki2",
		"lang": "en",
		"dir": "ltr"
	}
]

Actually, one lang and one dir could be enough, but I hope one day different wikis could get different languages code, as you said earlier. Thank you.

I think you’re conflating the configuration and the API output. The example given on the extension page correctly describes how $wgSiteMatrixSites should look like; your example is about what the API endpoint returns.

However, in fact, this configuration is technically optional – simply any wikis not mentioned in it count as special wikis. A site matrix with only special wikis and no sites makes little sense (it’s not really a matrix if it has a single column), but I think it should be fine for a patch demo. If I understand correctly, all we need in addition to enabling the extension is adding three lines to core.php (everything else needed – $wgLocalDatabases, $wgConf->suffixes – has already been added in !104 / T401243):

--- a/mediawiki/files/localSettings/core.php
+++ b/mediawiki/files/localSettings/core.php
@@ -72,6 +72,9 @@
         'default' => 1,
         $mainWikiDb => 0,
     ],
+    'wgLanguageCode' => [
+        'default' => $wgLanguageCode, // All wikis of the farm have the same language code
+    ],
 ];
 
 $wgConfGlobals = $wgConf->getAll($wgDBname);

I think you’re conflating the configuration and the API output. The example given on the extension page correctly describes how $wgSiteMatrixSites should look like; your example is about what the API endpoint returns.

Yes, looks like you're right, taking in account what I studied since that comment.