Bump up read/write timeouts on the connection to insane levels
authorBrion Vibber <brion@users.mediawiki.org>
Sun, 26 Jun 2005 07:44:28 +0000 (07:44 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Sun, 26 Jun 2005 07:44:28 +0000 (07:44 +0000)
maintenance/upgrade1_5.php

index ac7b852..0b51c46 100644 (file)
@@ -30,9 +30,7 @@ class FiveUpgrade {
                $this->conversionTables = $this->prepareWindows1252();
                
                $this->dbw =& $this->newConnection();
-               $this->dbr =& $this->newConnection();
-               $this->dbr->bufferResults( false );
-               $this->slave =& wfGetDB( DB_SLAVE );
+               $this->dbr =& $this->streamConnection();
                
                $this->cleanupSwaps = array();
                $this->emailAuth = false; # don't preauthenticate emails
@@ -74,9 +72,7 @@ class FiveUpgrade {
        
        
        /**
-        * Open a second connection to the master server, with buffering off.
-        * This will let us stream large datasets in and write in chunks on the
-        * other end.
+        * Open a connection to the master server with the admin rights.
         * @return Database
         * @access private
         */
@@ -87,6 +83,22 @@ class FiveUpgrade {
                return $db;
        }
        
+       /**
+        * Open a second connection to the master server, with buffering off.
+        * This will let us stream large datasets in and write in chunks on the
+        * other end.
+        * @return Database
+        * @access private
+        */
+       function &streamConnection() {
+               $timeout = 3600 * 24;
+               $db =& $this->newConnection();
+               $db->bufferResults( false );
+               $db->query( "SET net_read_timeout=$timeout" );
+               $db->query( "SET net_write_timeout=$timeout" );
+               return $db;
+       }
+       
        /**
         * Prepare a conversion array for converting Windows Code Page 1252 to
         * UTF-8. This should provide proper conversion of text that was miscoded