-class BackupDumper {
- var $reportingInterval = 100;
- var $reporting = true;
- var $pageCount = 0;
- var $revCount = 0;
- var $server = null; // use default
-
- function BackupDumper() {
- $this->stderr = fopen( "php://stderr", "wt" );
- }
-
- function dump( $history ) {
- # This shouldn't happen if on console... ;)
- header( 'Content-type: text/html; charset=UTF-8' );
-
- # Notice messages will foul up your XML output even if they're
- # relatively harmless.
- ini_set( 'display_errors', false );
-
- $this->startTime = wfTime();
-
- $db =& $this->backupDb();
- $exporter = new WikiExporter( $db, $history, MW_EXPORT_STREAM );
- $exporter->setPageCallback( array( &$this, 'reportPage' ) );
- $exporter->setRevisionCallback( array( &$this, 'revCount' ) );
-
- $exporter->openStream();
- $exporter->allPages();
- $exporter->closeStream();
-
- $this->report( true );
- }
-
- function &backupDb() {
- global $wgDBadminuser, $wgDBadminpassword;
- global $wgDBname;
- $db =& new Database( $this->backupServer(), $wgDBadminuser, $wgDBadminpassword, $wgDBname );
- return $db;
- }
-
- function backupServer() {
- global $wgDBserver;
- return $this->server
- ? $this->server
- : $wgDBserver;
- }