+ /**
+ * @param array $server Master DB server configuration array for LoadBalancer
+ * @return string|bool Database domain ID or false
+ */
+ private function getDomainId( array $server ) {
+ if ( isset( $server['dbname'] ) ) {
+ // T200471: for b/c, treat any "dbname" field as forcing which database to use.
+ // MediaWiki/LoadBalancer previously did not enforce any concept of a local DB
+ // domain, but rather assumed that the LB server configuration matched $wgDBname.
+ // This check is useful when the external storage DB for this cluster does not use
+ // the same name as the corresponding "main" DB(s) for wikis.
+ $domain = new DatabaseDomain(
+ $server['dbname'],
+ $server['schema'] ?? null,
+ $server['tablePrefix'] ?? ''
+ );
+
+ return $domain->getId();
+ }
+
+ return $this->params['wiki'] ?? false; // local domain unless explictly given
+ }
+