From: Siebrand Mazeland Date: Wed, 20 Nov 2013 10:27:05 +0000 (+0100) Subject: Remove function calls from for loop test part X-Git-Tag: 1.31.0-rc.0~17982 X-Git-Url: http://git.heureux-cyclage.org/?a=commitdiff_plain;h=0c2a9d4f97b4b9e6eb86cb8710b0b8a291cfbb45;p=lhc%2Fweb%2Fwiklou.git Remove function calls from for loop test part Change-Id: If1f8996854889b526fef96cd29a153e0b36e9133 --- diff --git a/includes/db/LoadBalancer.php b/includes/db/LoadBalancer.php index 011c0831cc..bfa1adda1d 100644 --- a/includes/db/LoadBalancer.php +++ b/includes/db/LoadBalancer.php @@ -372,7 +372,8 @@ class LoadBalancer { public function waitForAll( $pos ) { wfProfileIn( __METHOD__ ); $this->mWaitForPos = $pos; - for ( $i = 1; $i < count( $this->mServers ); $i++ ) { + $serverCount = count( $this->mServers ); + for ( $i = 1; $i < $serverCount; $i++ ) { if ( $this->mLoads[$i] > 0 ) { $this->doWait( $i, true ); } @@ -850,7 +851,8 @@ class LoadBalancer { # master (however unlikely that may be), then we can fetch the position from the slave. $masterConn = $this->getAnyOpenConnection( 0 ); if ( !$masterConn ) { - for ( $i = 1; $i < count( $this->mServers ); $i++ ) { + $serverCount = count( $this->mServers ); + for ( $i = 1; $i < $serverCount; $i++ ) { $conn = $this->getAnyOpenConnection( $i ); if ( $conn ) { wfDebug( "Master pos fetched from slave\n" );