From d7f7a69d6a992ed80b1b45fdb6e663168afd8b32 Mon Sep 17 00:00:00 2001 From: Greg Sabino Mullane Date: Mon, 21 Mar 2011 22:09:49 +0000 Subject: [PATCH] When switching from admin to non-admin account, make sure to set $this->db to null, otherwise MW will happily return the old handle, which means we end up in the old admin database, and thus create our 'mediawiki' schema in the postgres or template1 database (whoops!). There may be other similar cases in the code in which we are not clearing this->db before toggling the useAdmin attribute. Fixes bug 28171. --- includes/installer/PostgresInstaller.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/includes/installer/PostgresInstaller.php b/includes/installer/PostgresInstaller.php index 0b140a5faa..c237a11f01 100644 --- a/includes/installer/PostgresInstaller.php +++ b/includes/installer/PostgresInstaller.php @@ -231,11 +231,14 @@ class PostgresInstaller extends DatabaseInstaller { $conn->query( "ALTER DATABASE $safedb OWNER TO $safeuser", __METHOD__ ); } + // Now that we've established the real database exists, connect to it + // Because we do not want the same connection, forcibly expire the existing conn + $this->db = null; $this->useAdmin = false; - $status = $this->getConnection(); - if ( !$status->isOK() ) { - return $status; - } + $status = $this->getConnection(); + if ( !$status->isOK() ) { + return $status; + } $conn = $status->value; if( !$conn->schemaExists( $schema ) ) { -- 2.20.1