Index: trunk/phase3/maintenance/eval.php |
— | — | @@ -45,8 +45,11 @@ |
46 | 46 | } |
47 | 47 | if ( $d > 1 ) { |
48 | 48 | $lb = wfGetLB(); |
49 | | - foreach ( $lb->mServers as $i => $server ) { |
50 | | - $lb->mServers[$i]['flags'] |= DBO_DEBUG; |
| 49 | + $serverCount = $lb->getServerCount(); |
| 50 | + for ( $i = 0; $i < $serverCount; $i++ ) { |
| 51 | + $server = $lb->getServerInfo( $i ); |
| 52 | + $server['flags'] |= DBO_DEBUG; |
| 53 | + $lb->setServerInfo( $i, $server ); |
51 | 54 | } |
52 | 55 | } |
53 | 56 | if ( $d > 2 ) { |
Index: trunk/phase3/CREDITS |
— | — | @@ -142,6 +142,7 @@ |
143 | 143 | * Tisane |
144 | 144 | * Umherirrender |
145 | 145 | * Ville Stadista |
| 146 | +* Yuvaraj Pandian T |
146 | 147 | * Zachary Hauri |
147 | 148 | |
148 | 149 | == Translators == |
Index: trunk/phase3/includes/db/LoadBalancer.php |
— | — | @@ -13,13 +13,13 @@ |
14 | 14 | * @ingroup Database |
15 | 15 | */ |
16 | 16 | class LoadBalancer { |
17 | | - /* private */ var $mServers, $mConns, $mLoads, $mGroupLoads; |
18 | | - /* private */ var $mErrorConnection; |
19 | | - /* private */ var $mReadIndex, $mAllowLagged; |
20 | | - /* private */ var $mWaitForPos, $mWaitTimeout; |
21 | | - /* private */ var $mLaggedSlaveMode, $mLastError = 'Unknown error'; |
22 | | - /* private */ var $mParentInfo, $mLagTimes; |
23 | | - /* private */ var $mLoadMonitorClass, $mLoadMonitor; |
| 17 | + private $mServers, $mConns, $mLoads, $mGroupLoads; |
| 18 | + private $mErrorConnection; |
| 19 | + private $mReadIndex, $mAllowLagged; |
| 20 | + private $mWaitForPos, $mWaitTimeout; |
| 21 | + private $mLaggedSlaveMode, $mLastError = 'Unknown error'; |
| 22 | + private $mParentInfo, $mLagTimes; |
| 23 | + private $mLoadMonitorClass, $mLoadMonitor; |
24 | 24 | |
25 | 25 | /** |
26 | 26 | * @param $params Array with keys: |
— | — | @@ -91,8 +91,7 @@ |
92 | 92 | * Given an array of non-normalised probabilities, this function will select |
93 | 93 | * an element and return the appropriate key |
94 | 94 | */ |
95 | | - function pickRandom( $weights ) |
96 | | - { |
| 95 | + function pickRandom( $weights ) { |
97 | 96 | if ( !is_array( $weights ) || count( $weights ) == 0 ) { |
98 | 97 | return false; |
99 | 98 | } |
— | — | @@ -740,6 +739,13 @@ |
741 | 740 | } |
742 | 741 | |
743 | 742 | /** |
| 743 | + * Sets the server info structure for the given index. Entry at index $i is created if it doesn't exist |
| 744 | + */ |
| 745 | + function setServerInfo( $i, $serverInfo ) { |
| 746 | + $this->mServers[i] = $serverInfo; |
| 747 | + } |
| 748 | + |
| 749 | + /** |
744 | 750 | * Get the current master position for chronology control purposes |
745 | 751 | * @return mixed |
746 | 752 | */ |
Index: trunk/extensions/SimpleSecurity/SimpleSecurity_body.php |
— | — | @@ -378,7 +378,12 @@ |
379 | 379 | */ |
380 | 380 | static function updateLB( &$lb ) { |
381 | 381 | $lb->closeAll(); |
382 | | - foreach ( $lb->mServers as $i => $server ) $lb->mServers[$i]['type'] = 'SimpleSecurity'; |
| 382 | + $serverCount = $lb->getServerCount(); |
| 383 | + for ( $i = 0; $i < $serverCount; $i++ ) { |
| 384 | + $server = $lb->getServerInfo( $i ); |
| 385 | + $sever['type'] = 'SimpleSecurity'; |
| 386 | + $lb->setServerInfo ( $i, $server ); |
| 387 | + } |
383 | 388 | } |
384 | 389 | |
385 | 390 | |
Index: trunk/extensions/MakeDBError/MakeDBError_body.php |
— | — | @@ -14,9 +14,10 @@ |
15 | 15 | $this->setHeaders(); |
16 | 16 | if ( $par == 'connection' ) { |
17 | 17 | $lb = wfGetLB(); |
18 | | - $lb->mServers[1234] = $lb->mServers[0]; |
19 | | - $lb->mServers[1234]['user'] = 'chicken'; |
20 | | - $lb->mServers[1234]['password'] = 'cluck cluck'; |
| 18 | + $failServer = $lb->getServerInfo( 0 ); |
| 19 | + $failServer['user'] = 'chicken'; |
| 20 | + $failServer['password'] = 'cluck cluck'; |
| 21 | + $lb->setServerInfo ( 1234, $failServer ); /* What happens when there *are* actually >1234 servers? */ |
21 | 22 | $db = wfGetDB( 1234 ); |
22 | 23 | $wgOut->addHTML("<pre>" . var_export( $db, true ) . "</pre>" ); |
23 | 24 | } else { |