Page MenuHomePhabricator

Various core service factories doesn't work correctly when wiki ID contains a hyphen
Open, Needs TriagePublic

Description

For details, see T404118#11195674 and following comments. In short, it does the comparison $this->dbLoadBalancerFactory->getLocalDomainID() === $wikiId, but the LocalDomainID is encoded such that hyphen are replaced away, and thus it won't match a wiki ID obtained from, for example, WikiMap::getCurrentWikiID.

It looks like the fix would be to use WikiMap::getCurrentWikiID instead of getLocalDomainID, but this doesn't help with the fact that there seems to be confusion between wiki IDs and DB domains.

This pattern is used in at least 5 places (UserGroupManagerFactory, BlockRestrictionStoreFactory, DatabaseBlockStoreFactory, ActorStoreFactory, UserFactory).

Event Timeline

Change #1192158 had a related patch set uploaded (by Daimona Eaytoy; author: Daimona Eaytoy):

[mediawiki/core@master] user: Fix wiki ID comparison in UserGroupManagerFactory

https://gerrit.wikimedia.org/r/1192158

I'm realizing now that we use the same pattern in 4 more places (BlockRestrictionStoreFactory, DatabaseBlockStoreFactory, ActorStoreFactory, UserFactory). I'm not sure what to do then. It'd be great if this confusion between domain ID and wiki ID could be clarified.

Daimona renamed this task from UserGroupManagerFactory::getUserGroupManager doesn't work correctly when wiki ID contains a hyphen to Various core service factories doesn't work correctly when wiki ID contains a hyphen.Oct 8 2025, 7:58 PM
Daimona updated the task description. (Show Details)

I'm realizing now that we use the same pattern in 4 more places (BlockRestrictionStoreFactory, DatabaseBlockStoreFactory, ActorStoreFactory, UserFactory).

And I'm propagating the same code to RevisionStoreFactory as well, for T406777.