From aae07de760bfd7cc10994c85295ed2fcc217e4f5 Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Sun, 30 Mar 2008 15:16:50 +0000 Subject: [PATCH] Some fixes to the new load balancement system: * 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 | 4 ++-- includes/LBFactory_Multi.php | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/includes/LBFactory.php b/includes/LBFactory.php index ba509f727d..e0ffbc85f8 100644 --- a/includes/LBFactory.php +++ b/includes/LBFactory.php @@ -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] ) ) { diff --git a/includes/LBFactory_Multi.php b/includes/LBFactory_Multi.php index aee033af57..788a28c9a3 100644 --- a/includes/LBFactory_Multi.php +++ b/includes/LBFactory_Multi.php @@ -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\"" ); -- 2.20.1