]> scripts.mit.edu Git - autoinstallsdev/mediawiki.git/blobdiff - maintenance/backup.inc
MediaWiki 1.16.0
[autoinstallsdev/mediawiki.git] / maintenance / backup.inc
index e2e5363ece88d597f1a14d1b9324f959cffd0b5a..30bd0d88f8fc24e7a8f864cbedb9e79475267c97 100644 (file)
@@ -232,13 +232,13 @@ class BackupDumper {
                $this->startTime = wfTime();
        }
 
+       /**
+        * @fixme the --server parameter is currently not respected, as it doesn't seem
+        * terribly easy to ask the load balancer for a particular connection by name.
+        */
        function backupDb() {
-               global $wgDBadminuser, $wgDBadminpassword;
-               global $wgDBname, $wgDebugDumpSql, $wgDBtype;
-               $flags = ($wgDebugDumpSql ? DBO_DEBUG : 0) | DBO_DEFAULT; // god-damn hack
-
-               $class = 'Database' . ucfirst($wgDBtype);
-               $db = new $class( $this->backupServer(), $wgDBadminuser, $wgDBadminpassword, $wgDBname, false, $flags );
+               $this->lb = wfGetLBFactory()->newMainLB();
+               $db = $this->lb->getConnection( DB_SLAVE, 'backup' );
                
                // Discourage the server from disconnecting us if it takes a long time
                // to read out the big ol' batch query.
@@ -246,6 +246,12 @@ class BackupDumper {
                
                return $db;
        }
+       
+       function __destruct() {
+               if( isset( $this->lb ) ) {
+                       $this->lb->closeAll();
+               }
+       }
 
        function backupServer() {
                global $wgDBserver;