From 7916aeeaea7595766112d6f34535a0756604cca4 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Mon, 3 Nov 2014 16:52:42 -0800 Subject: [PATCH] Support empty DB names in LoadBalancer more fully * This convention to avoid selecting a DB is already supported for new connections but not when an existing foreign wiki connection is reused. This avoids giving PHP notices. Change-Id: Ic6e9ed031bc8ea6d6f519b6998f0414364c087d0 --- includes/db/LoadBalancer.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/includes/db/LoadBalancer.php b/includes/db/LoadBalancer.php index 186915c746..eeb2fec744 100644 --- a/includes/db/LoadBalancer.php +++ b/includes/db/LoadBalancer.php @@ -655,7 +655,9 @@ class LoadBalancer { $conn = reset( $this->mConns['foreignFree'][$i] ); $oldWiki = key( $this->mConns['foreignFree'][$i] ); - if ( !$conn->selectDB( $dbName ) ) { + // The empty string as a DB name means "don't care". + // DatabaseMysqlBase::open() already handle this on connection. + if ( $dbName !== '' && !$conn->selectDB( $dbName ) ) { $this->mLastError = "Error selecting database $dbName on server " . $conn->getServer() . " from client host " . wfHostname() . "\n"; $this->mErrorConnection = $conn; -- 2.20.1