+ // Since the schema was not always part of the wiki ID, try to maintain backwards
+ // compatibility with some common cases. Assume that if the DB domain schema is just
+ // the installer default then it is probably the case that the schema is the same for
+ // all wikis in the farm. Historically, any wiki farm had to make the database/prefix
+ // combination unique per wiki. Ommit the schema if it does not seem wiki specific.
+ if ( !in_array( $domain->getSchema(), [ null, 'mediawiki', 'dbo' ], true ) ) {
+ // This means a site admin may have specifically taylored the schemas.
+ // Domain IDs might use the form <DB>-<project>- or <DB>-<project>-<language>_,
+ // meaning that the schema portion must be accounted for to disambiguate wikis.
+ return "{$domain->getDatabase()}-{$domain->getSchema()}-{$domain->getTablePrefix()}";
+ }
+ // Note that if this wiki ID is passed a a domain ID to LoadBalancer, then it can
+ // handle the schema by assuming the generic "mediawiki" schema if needed.