Fix SQLite exception when $wgDBuser is set
authorTim Starling <tstarling@wikimedia.org>
Thu, 17 Oct 2013 04:16:46 +0000 (15:16 +1100)
committerAaron Schulz <aschulz@wikimedia.org>
Thu, 17 Oct 2013 22:36:47 +0000 (22:36 +0000)
commit01bc04f1788471348bf9c4ad0473ab0938d427cd
tree1dd1639005d1d8252e166ccf2c8886c8cdeb0556
parent18ac912782524af5d85836ba7098adfcc0e16e6e
Fix SQLite exception when $wgDBuser is set

Fixed from several different directions:
* The error reporting was screwed up, so I wrapped the PDOException
  in a DBUnexpectedError.
* Make $db->open() trigger a close/open sequence if called a second
  time, like MySQL, instead of breaking mTrxLevel.
* Don't call $this->open() twice from the constructor, even if $user is
  set.

The bug dates to r84485. The nasty hack allowing you to construct a
do-nothing database object with "new Database()" dates back to 2004 and
has probably outlived its usefulness -- noted this. It was formerly used
by LoadBalancer::reportConnectionError().

Bug: 49254
Change-Id: I571f9209bec8e8ed5058b6327e1738eb4315d5a0
includes/db/Database.php
includes/db/DatabaseSqlite.php