Revert r29671, it was based on a misunderstanding of the purpose of the LoggedOut...
[lhc/web/wiklou.git] / includes / LoadBalancer.php
index 28f7a78..657bb2c 100644 (file)
@@ -418,9 +418,7 @@ class LoadBalancer {
         * @access private
         */
        function reallyOpenConnection( &$server ) {
-               wfProfileIn( __METHOD__ );
                if( !is_array( $server ) ) {
-                       wfProfileOut( __METHOD__ );
                        throw new MWException( 'You must update your load-balancing configuration. See DefaultSettings.php entry for $wgDBservers.' );
                }
 
@@ -431,7 +429,6 @@ class LoadBalancer {
                # Create object
                $db = new $class( $host, $user, $password, $dbname, 1, $flags );
                $db->setLBInfo( $server );
-               wfProfileOut( __METHOD__ );
                return $db;
        }
 
@@ -555,6 +552,17 @@ class LoadBalancer {
                        }
                }
        }
+       
+       /* Issue COMMIT only on master, only if queries were done on connection */
+       function commitMasterChanges() {
+               // Always 0, but who knows.. :)
+               $i = $this->getWriterIndex();
+               if (array_key_exists($i,$this->mConnections)) {
+                       if ($this->mConnections[$i]->lastQuery() != '') {
+                               $this->mConnections[$i]->immediateCommit();
+                       }
+               }
+       }
 
        function waitTimeout( $value = NULL ) {
                return wfSetVar( $this->mWaitTimeout, $value );