From 222b01f5169f1c7e69762e0e8904c24f78f71882 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Wed, 28 Jul 2010 11:52:48 +0200 Subject: update to MediaWiki 1.16.0 --- maintenance/backup.inc | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'maintenance/backup.inc') 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; -- cgit v1.2.3-54-g00ecf