From: Aaron Schulz Date: Tue, 4 Nov 2014 00:52:42 +0000 (-0800) Subject: Support empty DB names in LoadBalancer more fully X-Git-Tag: 1.31.0-rc.0~13389^2 X-Git-Url: http://git.cyclocoop.org/data/Luca_Pacioli_%28Gemaelde%29.jpeg?a=commitdiff_plain;h=7916aeeaea7595766112d6f34535a0756604cca4;p=lhc%2Fweb%2Fwiklou.git 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 --- 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;