X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2Fincludes%2FBackupDumper.php;h=425bf36c380f4059a7d2ddc6a7f71179a50c789d;hb=9314453c93e9daa502a706063b66d003adcbee0b;hp=673ea7f86475504a97bd401d221a852fc1075cff;hpb=007bfbf83578df5010415d5822c6aec057ffaa88;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/includes/BackupDumper.php b/maintenance/includes/BackupDumper.php index 673ea7f864..425bf36c38 100644 --- a/maintenance/includes/BackupDumper.php +++ b/maintenance/includes/BackupDumper.php @@ -51,6 +51,7 @@ abstract class BackupDumper extends Maintenance { 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; @@ -74,9 +75,6 @@ abstract class BackupDumper extends Maintenance { /** @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 */ @@ -89,6 +87,7 @@ abstract class BackupDumper extends Maintenance { $this->registerOutput( 'gzip', DumpGZipOutput::class ); $this->registerOutput( 'bzip2', DumpBZip2Output::class ); $this->registerOutput( 'dbzip2', DumpDBZip2Output::class ); + $this->registerOutput( 'lbzip2', DumpLBZip2Output::class ); $this->registerOutput( '7zip', Dump7ZipOutput::class ); $this->registerFilter( 'latest', DumpLatestFilter::class ); @@ -99,11 +98,13 @@ abstract class BackupDumper extends Maintenance { $this->addOption( 'plugin', 'Load a dump plugin class. Specify as [:].', false, true, false, true ); $this->addOption( 'output', 'Begin a filtered output stream; Specify as :. ' . - 's: file, gzip, bzip2, 7zip, dbzip2', false, true, false, true ); + 's: file, gzip, bzip2, 7zip, dbzip2, lbzip2', false, true, false, true ); $this->addOption( 'filter', 'Add a filter on an output branch. Specify as ' . '[:]. 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 ); @@ -158,10 +159,11 @@ abstract class BackupDumper extends Maintenance { $sink = null; $sinks = []; + $this->schemaVersion = WikiExporter::schemaVersion(); + $options = $this->orderedOptions; foreach ( $options as $arg ) { - $opt = $arg[0]; - $param = $arg[1]; + list( $opt, $param ) = $arg; switch ( $opt ) { case 'plugin': @@ -218,6 +220,15 @@ abstract class BackupDumper extends Maintenance { 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; } } @@ -253,6 +264,7 @@ abstract class BackupDumper extends Maintenance { $db = $this->backupDb(); $exporter = new WikiExporter( $db, $history, $text ); + $exporter->setSchemaVersion( $this->schemaVersion ); $exporter->dumpUploads = $this->dumpUploads; $exporter->dumpUploadFileContents = $this->dumpUploadFileContents;