return $this->getServerVersion();
}
- /**
- * Fail function, takes a Database as a parameter
- * Set to false for default, 1 for ignore errors
- */
- function failFunction( $function = null ) {
- return wfSetVar( $this->mFailFunction, $function );
- }
-
/**
* Boolean, controls output of large amounts of debug information
*/
if ( !isset( $wgOut ) ) {
$wgOut = null;
}
-
- $this->mFailFunction = $failFunction;
$this->mFlags = $flags;
if ( $this->mFlags & DBO_DEFAULT ) {
$error = $myError;
}
- if ( $this->mFailFunction ) {
- # Legacy error handling method
- if ( !is_int( $this->mFailFunction ) ) {
- $ff = $this->mFailFunction;
- $ff( $this, $error );
- }
- } else {
- # New method
- throw new DBConnectionError( $this, $error );
- }
+ # New method
+ throw new DBConnectionError( $this, $error );
}
/**
$wgOut = null;
}
$this->mOut =& $wgOut;
- $this->mFailFunction = $failFunction;
$this->mFlags = DBO_TRX | $flags;
if ( $schema == self::USE_GLOBAL ) {
function __construct( $server = false, $user = false, $password = false, $dbName = false,
$failFunction = false, $flags = 0 )
{
- $this->mFailFunction = $failFunction;
$this->mFlags = $flags;
$this->open( $server, $user, $password, $dbName );
-
}
function cascadingDeletes() {
function __construct( $server = false, $user = false, $password = false, $dbName = false,
$failFunction = false, $flags = 0 )
{
- $this->mFailFunction = $failFunction;
$this->mFlags = $flags;
$this->open( $server, $user, $password, $dbName );
}
wfDebug( "DB connection error\n" );
wfDebug( "Server: $server, Database: $dbName, User: $user, Password: " . substr( $password, 0, 3 ) . "...\n" );
wfDebug( $this->lastError() . "\n" );
- if ( !$this->mFailFunction ) {
- throw new DBConnectionError( $this, $phpError );
- } else {
- return false;
- }
+ throw new DBConnectionError( $this, $phpError );
}
$this->mOpened = true;
*/
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;
}
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
}
$this->mServers = $params['servers'];
- if ( isset( $params['failFunction'] ) ) {
- $this->mFailFunction = $params['failFunction'];
- } else {
- $this->mFailFunction = false;
- }
if ( isset( $params['waitTimeout'] ) ) {
$this->mWaitTimeout = $params['waitTimeout'];
} else {
// No last connection, probably due to all servers being too busy
wfLogDBError( "LB failure with no last connection\n" );
$conn = new Database;
- if ( $this->mFailFunction ) {
- $conn->failFunction( $this->mFailFunction );
- $conn->reportConnectionError( $this->mLastError );
- } else {
- // If all servers were busy, mLastError will contain something sensible
- throw new DBConnectionError( $conn, $this->mLastError );
- }
+ // If all servers were busy, mLastError will contain something sensible
+ throw new DBConnectionError( $conn, $this->mLastError );
} else {
- if ( $this->mFailFunction ) {
- $conn->failFunction( $this->mFailFunction );
- } else {
- $conn->failFunction( false );
- }
$server = $conn->getProperty( 'mServer' );
wfLogDBError( "Connection error: {$this->mLastError} ({$server})\n" );
$conn->reportConnectionError( "{$this->mLastError} ({$server})" );