*/
function __construct( $server = false, $user = false, $password = false, $dbName = false, $failFunction = false, $flags = 0 ) {
global $wgSharedDB;
- $this->mFailFunction = $failFunction;
$this->mFlags = $flags;
$this->mName = $dbName;
}
}
- /**
- * Serialization handler, see http://php.net/manual/en/language.oop5.magic.php#language.oop5.magic.sleep
- * for details. Instances of this class sometimes get serialized, e.g. with Title and its BacklinkCache
- * Because attempts to serialize mConn end in "can't serialize PDO objects" exceptions, we simply disallow
- * to serialize anything in this class.
- */
- function __sleep() {
- return array();
- }
-
function getType() {
return 'sqlite';
}
} catch ( PDOException $e ) {
$err = $e->getMessage();
}
- if ( $this->mConn === false ) {
+ if ( !$this->mConn ) {
wfDebug( "DB connection error: $err\n" );
- if ( !$this->mFailFunction ) {
- throw new DBConnectionError( $this, $err );
- } else {
- return false;
- }
-
+ throw new DBConnectionError( $this, $err );
}
$this->mOpened = !!$this->mConn;
# set error codes only, don't raise exceptions