* Accept --server option for database to read main query from on backup
authorBrion Vibber <brion@users.mediawiki.org>
Wed, 13 Jul 2005 01:57:43 +0000 (01:57 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Wed, 13 Jul 2005 01:57:43 +0000 (01:57 +0000)
RELEASE-NOTES
maintenance/dumpBackup.php

index d357000..d7b93bf 100644 (file)
@@ -565,6 +565,7 @@ of MediaWiki:Newpagetext) to &action=edit, if page is new.
 * Nynorsk numeric format fix
 * (bug 2825) Fix regression in newtalk notifications for anons w/ enotif off
 * (bug 2833) Fix bug in previous fix
+* Accept --server option for database to read main query from on backup
 
 
 === Caveats ===
index 28ff27c..8eaba39 100644 (file)
@@ -22,7 +22,7 @@
  * @subpackage SpecialPage
  */
 
-$options = array( 'full', 'current' );
+$options = array( 'full', 'current', 'server' );
 
 require_once( 'commandLine.inc' );
 require_once( 'SpecialExport.php' );
@@ -32,6 +32,7 @@ class BackupDumper {
        var $reporting = true;
        var $pageCount = 0;
        var $revCount  = 0;
+       var $server    = null; // use default
        
        function BackupDumper() {
                $this->stderr = fopen( "php://stderr", "wt" );
@@ -61,10 +62,17 @@ class BackupDumper {
        
        function &backupDb() {
                global $wgDBadminuser, $wgDBadminpassword;
-               global $wgDBserver, $wgDBname;
-               $db =& new Database( $wgDBserver, $wgDBadminuser, $wgDBadminpassword, $wgDBname );
+               global $wgDBname;
+               $db =& new Database( $this->backupServer(), $wgDBadminuser, $wgDBadminpassword, $wgDBname );
                return $db;
        }
+       
+       function backupServer() {
+               global $wgDBserver;
+               return $this->server
+                       ? $this->server
+                       : $wgDBserver;
+       }
 
        function reportPage( $page ) {
                $this->pageCount++;
@@ -91,7 +99,8 @@ class BackupDumper {
                                $rate = '-';
                                $revrate = '-';
                        }
-                       $this->progress( "$this->pageCount ($rate pages/sec $revrate revs/sec)" );
+                       global $wgDBname;
+                       $this->progress( "$wgDBname $this->pageCount ($rate pages/sec $revrate revs/sec)" );
                }
        }
        
@@ -107,6 +116,9 @@ if( isset( $options['quiet'] ) ) {
 if( isset( $options['report'] ) ) {
        $dumper->reportingInterval = IntVal( $options['report'] );
 }
+if( isset( $options['server'] ) ) {
+       $dumper->server = $options['server'];
+}
 if( isset( $options['full'] ) ) {
        $dumper->dump( MW_EXPORT_FULL );
 } elseif( isset( $options['current'] ) ) {