From: Aaron Schulz Date: Wed, 15 Aug 2018 01:44:40 +0000 (-0700) Subject: Make ExternalStoreDB "wiki" context override the server "dbname" field X-Git-Tag: 1.34.0-rc.0~4431^2 X-Git-Url: http://git.cyclocoop.org/%28%5B%5E//%22%22?a=commitdiff_plain;h=f7009eeb9568874b0ca726cd0bd4a3372d205547;p=lhc%2Fweb%2Fwiklou.git Make ExternalStoreDB "wiki" context override the server "dbname" field This is all that is needed for b/c and going beyond that can break foreign wiki (domain) external store access if matching per-wiki DB names *are* used for external store. Follow up to 92e4ace7eae61. Bug: T200471 Change-Id: I877139ff659f542da04d4d8f5ef3297dbfcfd734 --- diff --git a/includes/externalstore/ExternalStoreDB.php b/includes/externalstore/ExternalStoreDB.php index 5a77e891ba..75f7ccdfab 100644 --- a/includes/externalstore/ExternalStoreDB.php +++ b/includes/externalstore/ExternalStoreDB.php @@ -166,6 +166,10 @@ class ExternalStoreDB extends ExternalStoreMedium { * @return string|bool Database domain ID or false */ private function getDomainId( array $server ) { + if ( isset( $this->params['wiki'] ) ) { + return $this->params['wiki']; // explicit domain + } + 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 @@ -181,7 +185,7 @@ class ExternalStoreDB extends ExternalStoreMedium { return $domain->getId(); } - return $this->params['wiki'] ?? false; // local domain unless explictly given + return false; // local LB domain } /**