Some fixes to the new load balancement system:
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Sun, 30 Mar 2008 15:16:50 +0000 (15:16 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Sun, 30 Mar 2008 15:16:50 +0000 (15:16 +0000)
* return LBFactory::getExternalLB() as reference to avoid an E_NOTICE in ExternalStoreDB::getLoadBalancer()
* remove unused global declaration of $wgExternalServers in LBFactory_Multi::getExternalLB()

includes/LBFactory.php
includes/LBFactory_Multi.php

index ba509f7..e0ffbc8 100644 (file)
@@ -37,7 +37,7 @@ abstract class LBFactory {
         * @param string $cluster External storage cluster, or false for core
         * @param string $wiki Wiki ID, or false for the current wiki
         */
-       abstract function getExternalLB( $cluster, $wiki = false );
+       abstract function &getExternalLB( $cluster, $wiki = false );
 
        /**
         * Execute a function for each tracked load balancer
@@ -111,7 +111,7 @@ class LBFactory_Simple extends LBFactory {
                return $this->mainLB;
        }
 
-       function getExternalLB( $cluster, $wiki = false ) {
+       function &getExternalLB( $cluster, $wiki = false ) {
                global $wgExternalServers;
                if ( !isset( $this->extLBs[$cluster] ) ) {
                        if ( !isset( $wgExternalServers[$cluster] ) ) {
index aee033a..788a28c 100644 (file)
@@ -102,8 +102,7 @@ class LBFactory_Multi extends LBFactory {
                return $this->mainLBs[$section];
        }
 
-       function getExternalLB( $cluster, $wiki = false ) {
-               global $wgExternalServers;
+       function &getExternalLB( $cluster, $wiki = false ) {
                if ( !isset( $this->extLBs[$cluster] ) ) {
                        if ( !isset( $this->externalLoads[$cluster] ) ) {
                                throw new MWException( __METHOD__.": Unknown cluster \"$cluster\"" );