jenkins-bot has submitted this change and it was merged.

Change subject: Set an initial dummy domain in Database::__construct()
......................................................................


Set an initial dummy domain in Database::__construct()

This avoids errors when LoadBalancer calls getWikiId() in
reallyOpenConnection() after a failed connection.

Change-Id: Idc3d93ae39be09f2da277df57cdc5a564cb3408d
---
M includes/libs/rdbms/database/Database.php
1 file changed, 7 insertions(+), 3 deletions(-)

Approvals:
  Krinkle: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/libs/rdbms/database/Database.php 
b/includes/libs/rdbms/database/Database.php
index a5b9284..901afd1 100644
--- a/includes/libs/rdbms/database/Database.php
+++ b/includes/libs/rdbms/database/Database.php
@@ -281,6 +281,9 @@
                        ? $params['queryLogger']
                        : new \Psr\Log\NullLogger();
 
+               // Set initial dummy domain until open() sets the final 
DB/prefix
+               $this->currentDomain = DatabaseDomain::newUnspecified();
+
                if ( $user ) {
                        $this->open( $server, $user, $password, $dbName );
                } elseif ( $this->requiresDatabaseUser() ) {
@@ -288,9 +291,10 @@
                }
 
                // Set the domain object after open() sets the relevant fields
-               $this->currentDomain = ( $this->mDBname != '' )
-                       ? new DatabaseDomain( $this->mDBname, null, 
$this->mTablePrefix )
-                       : DatabaseDomain::newUnspecified();
+               if ( $this->mDBname != '' ) {
+                       // Domains with server scope but a table prefix are not 
used by IDatabase classes
+                       $this->currentDomain = new DatabaseDomain( 
$this->mDBname, null, $this->mTablePrefix );
+               }
        }
 
        /**

-- 
To view, visit https://gerrit.wikimedia.org/r/311724
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Idc3d93ae39be09f2da277df57cdc5a564cb3408d
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <asch...@wikimedia.org>
Gerrit-Reviewer: Krinkle <krinklem...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to