From b464cb7b97b5bb4eed62a67e0e0a401fd4175d44 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Mon, 6 Dec 2004 01:14:53 +0000 Subject: [PATCH] * Fix for load balancing mode, notify if using old settings format --- includes/LoadBalancer.php | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/includes/LoadBalancer.php b/includes/LoadBalancer.php index 9813c2af42..7ea09fcab6 100644 --- a/includes/LoadBalancer.php +++ b/includes/LoadBalancer.php @@ -191,7 +191,7 @@ class LoadBalancer { } if ( !$retVal && $this->isOpen( $index ) ) { - $conn =& $this->mConnections( $index ); + $conn =& $this->mConnections[$index]; wfDebug( "Waiting for slave #$index to catch up...\n" ); $result = $conn->masterPosWait( $this->mWaitForFile, $this->mWaitForPos, MASTER_WAIT_TIMEOUT ); @@ -303,15 +303,19 @@ class LoadBalancer { * @private */ function reallyOpenConnection( &$server ) { - extract( $server ); - # Get class for this database type - $class = 'Database' . ucfirst( $type ); - if ( !class_exists( $class ) ) { - require_once( "$class.php" ); - } + if( !is_array( $server ) ) { + wfDebugDieBacktrace( 'You must update your load-balancing configuration. See DefaultSettings.php entry for $wgDBservers.' ); + } + + extract( $server ); + # Get class for this database type + $class = 'Database' . ucfirst( $type ); + if ( !class_exists( $class ) ) { + require_once( "$class.php" ); + } - # Create object - return new $class( $host, $user, $password, $dbname, 1, $flags ); + # Create object + return new $class( $host, $user, $password, $dbname, 1, $flags ); } function reportConnectionError( &$conn ) -- 2.20.1