Change @since and @deprecated notes to 1.22
[lhc/web/wiklou.git] / includes / db / LoadBalancer.php
index e2434a0..db709b5 100644 (file)
@@ -78,7 +78,7 @@ class LoadBalancer {
                        }
                }
 
-               foreach( $params['servers'] as $i => $server ) {
+               foreach ( $params['servers'] as $i => $server ) {
                        $this->mLoads[$i] = $server['load'];
                        if ( isset( $server['groupLoads'] ) ) {
                                foreach ( $server['groupLoads'] as $group => $ratio ) {
@@ -117,7 +117,7 @@ class LoadBalancer {
         * Given an array of non-normalised probabilities, this function will select
         * an element and return the appropriate key
         *
-        * @deprecated 1.21, use ArrayUtils::pickRandom()
+        * @deprecated since 1.21, use ArrayUtils::pickRandom()
         *
         * @param $weights array
         *
@@ -479,6 +479,7 @@ class LoadBalancer {
 
                # Operation-based index
                if ( $i == DB_SLAVE ) {
+                       $this->mLastError = 'Unknown error'; // reset error string
                        $i = $this->getReaderIndex( false, $wiki );
                        # Couldn't find a working server in getReaderIndex()?
                        if ( $i === false ) {
@@ -665,7 +666,7 @@ class LoadBalancer {
         * @return bool
         */
        function isOpen( $index ) {
-               if( !is_integer( $index ) ) {
+               if ( !is_integer( $index ) ) {
                        return false;
                }
                return (bool)$this->getAnyOpenConnection( $index );
@@ -682,7 +683,7 @@ class LoadBalancer {
         * @return DatabaseBase
         */
        function reallyOpenConnection( $server, $dbNameOverride = false ) {
-               if( !is_array( $server ) ) {
+               if ( !is_array( $server ) ) {
                        throw new MWException( 'You must update your load-balancing configuration. ' .
                                'See DefaultSettings.php entry for $wgDBservers.' );
                }
@@ -833,7 +834,7 @@ class LoadBalancer {
         */
        function closeAll() {
                foreach ( $this->mConns as $conns2 ) {
-                       foreach  ( $conns2 as $conns3 ) {
+                       foreach ( $conns2 as $conns3 ) {
                                foreach ( $conns3 as $conn ) {
                                        $conn->close();
                                }