- function &backupDb() {
- global $wgDBadminuser, $wgDBadminpassword;
- global $wgDBname, $wgDebugDumpSql;
- $flags = ($wgDebugDumpSql ? DBO_DEBUG : 0) | DBO_DEFAULT; // god-damn hack
- $db =& new Database( $this->backupServer(), $wgDBadminuser, $wgDBadminpassword, $wgDBname, false, $flags );
- $timeout = 3600 * 24;
- $db->query( "SET net_read_timeout=$timeout" );
- $db->query( "SET net_write_timeout=$timeout" );
+ /**
+ * @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() {
+ $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.
+ $db->setTimeout( 3600 * 24 );
+