diff options
Diffstat (limited to 'maintenance/backup.inc')
-rw-r--r-- | maintenance/backup.inc | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/maintenance/backup.inc b/maintenance/backup.inc index e2e5363e..30bd0d88 100644 --- a/maintenance/backup.inc +++ b/maintenance/backup.inc @@ -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; |