From: Greg Sabino Mullane Date: Mon, 21 Mar 2011 22:09:49 +0000 (+0000) Subject: When switching from admin to non-admin account, make sure to set $this->db to null... X-Git-Tag: 1.31.0-rc.0~31262 X-Git-Url: http://git.cyclocoop.org/wiki/Target_page?a=commitdiff_plain;h=d7f7a69d6a992ed80b1b45fdb6e663168afd8b32;p=lhc%2Fweb%2Fwiklou.git 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. --- 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 ) ) {