In GlobalFunctions.php, there is a function wfWikiID(). This one always seemed to me like an ad-hoc solution from the time where caching has been introduced. A system wide unique wiki ID is build from the name of the DB and a possible table prefix. From version 1.12 or 1.13 on, this task is lead to a Database object if given as optional argument. And then there is the ForeignDBRepo that has to make a guess on the wiki ID of the repository wiki. Things seem to become more and more complicated.
And actualy, it's so simple: We just want to have a short string that identifies a wiki.
I would like to propose this:
- Introduce a new global configuration variable, let's say $wgWikiId.
- Set its default value to what wfWikiID() returns, but only if not set in LocalSettings.php.
- Add an other parameter to the info array passed to the constructor of ForeignDBRepo. Let's say 'wikiId'. It is the wiki ID of the foreign repository wiki that has to be used when hasSharedCache is set to true.
I think, this would be much more straight forward and even more flexible for those who use MediaWiki in a non-standard installtion. For example, it would solve all the trouble we have with cache keys on our PostgreSQL based cluster with 7 wikis, all in the same DB, but each of them in a separate schema.