* Fix for load balancing mode, notify if using old settings format
authorBrion Vibber <brion@users.mediawiki.org>
Mon, 6 Dec 2004 01:14:53 +0000 (01:14 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Mon, 6 Dec 2004 01:14:53 +0000 (01:14 +0000)
includes/LoadBalancer.php

index 9813c2a..7ea09fc 100644 (file)
@@ -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 )