From: Sam Reed Date: Sun, 24 Oct 2010 20:48:48 +0000 (+0000) Subject: Start of bug 24853, killing off 'functional' parts of failfunction code. Seems when... X-Git-Tag: 1.31.0-rc.0~34330 X-Git-Url: http://git.cyclocoop.org/?a=commitdiff_plain;ds=sidebyside;h=16cded8b32fc671125d89af1827f49665715c0ea;p=lhc%2Fweb%2Fwiklou.git Start of bug 24853, killing off 'functional' parts of failfunction code. Seems when the constructors start getting changed, it starts borking. Using this as a point of reversion/stashing --- diff --git a/includes/db/Database.php b/includes/db/Database.php index 595ceab0bb..67979b8265 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -235,14 +235,6 @@ abstract class DatabaseBase implements DatabaseType { 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 */ @@ -500,8 +492,6 @@ abstract class DatabaseBase implements DatabaseType { if ( !isset( $wgOut ) ) { $wgOut = null; } - - $this->mFailFunction = $failFunction; $this->mFlags = $flags; if ( $this->mFlags & DBO_DEFAULT ) { @@ -589,16 +579,8 @@ abstract class DatabaseBase implements DatabaseType { $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 ); } /** diff --git a/includes/db/DatabaseIbm_db2.php b/includes/db/DatabaseIbm_db2.php index 2e6f8c123c..5fbf81c7ae 100644 --- a/includes/db/DatabaseIbm_db2.php +++ b/includes/db/DatabaseIbm_db2.php @@ -273,7 +273,6 @@ class DatabaseIbm_db2 extends DatabaseBase { $wgOut = null; } $this->mOut =& $wgOut; - $this->mFailFunction = $failFunction; $this->mFlags = DBO_TRX | $flags; if ( $schema == self::USE_GLOBAL ) { diff --git a/includes/db/DatabaseMssql.php b/includes/db/DatabaseMssql.php index 7acb36caa4..d44bf323f7 100644 --- a/includes/db/DatabaseMssql.php +++ b/includes/db/DatabaseMssql.php @@ -20,10 +20,8 @@ class DatabaseMssql extends DatabaseBase { 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() { diff --git a/includes/db/DatabasePostgres.php b/includes/db/DatabasePostgres.php index a694734120..ddf2fdb991 100644 --- a/includes/db/DatabasePostgres.php +++ b/includes/db/DatabasePostgres.php @@ -103,7 +103,6 @@ class DatabasePostgres extends DatabaseBase { 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 ); } @@ -192,11 +191,7 @@ class DatabasePostgres extends DatabaseBase { 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; diff --git a/includes/db/DatabaseSqlite.php b/includes/db/DatabaseSqlite.php index 103744af03..1313252329 100644 --- a/includes/db/DatabaseSqlite.php +++ b/includes/db/DatabaseSqlite.php @@ -25,7 +25,6 @@ class DatabaseSqlite extends DatabaseBase { */ 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; @@ -80,12 +79,7 @@ class DatabaseSqlite extends DatabaseBase { } 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 diff --git a/includes/db/LoadBalancer.php b/includes/db/LoadBalancer.php index 19773900d5..e94ebb2288 100644 --- a/includes/db/LoadBalancer.php +++ b/includes/db/LoadBalancer.php @@ -35,11 +35,6 @@ class LoadBalancer { } $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 { @@ -671,19 +666,9 @@ class LoadBalancer { // 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})" );