r84497 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r84496‎ | r84497 | r84498 >
Date:22:09, 21 March 2011
Author:greg
Status:ok (Comments)
Tags:
Comment:
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.
Modified paths:
  • /trunk/phase3/includes/installer/PostgresInstaller.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/installer/PostgresInstaller.php
@@ -231,11 +231,14 @@
232232 $conn->query( "ALTER DATABASE $safedb OWNER TO $safeuser", __METHOD__ );
233233 }
234234
 235+ // Now that we've established the real database exists, connect to it
 236+ // Because we do not want the same connection, forcibly expire the existing conn
 237+ $this->db = null;
235238 $this->useAdmin = false;
236 - $status = $this->getConnection();
237 - if ( !$status->isOK() ) {
238 - return $status;
239 - }
 239+ $status = $this->getConnection();
 240+ if ( !$status->isOK() ) {
 241+ return $status;
 242+ }
240243 $conn = $status->value;
241244
242245 if( !$conn->schemaExists( $schema ) ) {

Comments

#Comment by 😂 (talk | contribs)   18:12, 27 March 2011

I don't really like this, going to clean it up.

Status & tagging log