protected $reportingInterval = 100;
protected $pageCount = 0;
protected $revCount = 0;
+ protected $schemaVersion = null; // use default
protected $server = null; // use default
protected $sink = null; // Output filters
protected $lastTime = 0;
/** @var LoadBalancer */
protected $lb;
- // @todo Unused?
- private $stubText = false; // include rev_text_id instead of text; for 2-pass dump
-
/**
* @param array|null $args For backward compatibility
*/
'<type>[:<options>]. <types>s: latest, notalk, namespace', false, true, false, true );
$this->addOption( 'report', 'Report position and speed after every n pages processed. ' .
'Default: 100.', false, true );
+ $this->addOption( 'schema-version', 'Schema version to use for output. ' .
+ 'Default: ' . WikiExporter::schemaVersion(), false, true );
$this->addOption( 'server', 'Force reading from MySQL server', false, true );
$this->addOption( '7ziplevel', '7zip compression level for all 7zip outputs. Used for ' .
'-mx option to 7za command.', false, true );
$sink = null;
$sinks = [];
+ $this->schemaVersion = WikiExporter::schemaVersion();
+
$options = $this->orderedOptions;
foreach ( $options as $arg ) {
$opt = $arg[0];
switch ( $opt ) {
case 'plugin':
- $val = explode( ':', $param );
+ $val = explode( ':', $param, 2 );
if ( count( $val ) === 1 ) {
$this->loadPlugin( $val[0], '' );
} elseif ( count( $val ) === 2 ) {
$this->loadPlugin( $val[0], $val[1] );
- } else {
- $this->fatalError( 'Invalid plugin parameter' );
- return;
}
break;
$sink = new DumpOutput();
}
- $split = explode( ':', $param );
+ $split = explode( ':', $param, 2 );
$key = $split[0];
if ( !isset( $this->filterTypes[$key] ) ) {
$filter = new $type( $sink );
} elseif ( count( $split ) === 2 ) {
$filter = new $type( $sink, $split[1] );
- } else {
- $this->fatalError( 'Invalid filter parameter' );
}
// references are lame in php...
unset( $sink );
$sink = $filter;
+ break;
+ case 'schema-version':
+ if ( !in_array( $param, XmlDumpWriter::$supportedSchemas ) ) {
+ $this->fatalError(
+ "Unsupported schema version $param. Supported versions: " .
+ implode( ', ', XmlDumpWriter::$supportedSchemas )
+ );
+ }
+ $this->schemaVersion = $param;
break;
}
}
$db = $this->backupDb();
$exporter = new WikiExporter( $db, $history, $text );
+ $exporter->setSchemaVersion( $this->schemaVersion );
$exporter->dumpUploads = $this->dumpUploads;
$exporter->dumpUploadFileContents = $this->dumpUploadFileContents;
function backupServer() {
global $wgDBserver;
- return $this->server
- ? $this->server
- : $wgDBserver;
+ return $this->server ?: $wgDBserver;
}
function reportPage() {