diff options
author | daniel <dkinzler@wikimedia.org> | 2018-12-14 12:24:44 +0100 |
---|---|---|
committer | daniel <dkinzler@wikimedia.org> | 2019-03-21 12:43:32 +0100 |
commit | 45f3912bf1e74cc29c23b151a45c446f79addabf (patch) | |
tree | 543ab17ecac772c51efde6dca3b4a24ea57afd26 /includes/export/WikiExporter.php | |
parent | 135718b90478b94052a2575e60f38406366055e7 (diff) | |
download | mediawikicore-45f3912bf1e74cc29c23b151a45c446f79addabf.tar.gz mediawikicore-45f3912bf1e74cc29c23b151a45c446f79addabf.zip |
Make the XML dump schema version configurable.
Bug: T174031
Change-Id: I979b6c8f0a72bc1f5ecce1d499d3fdfa0f671588
Diffstat (limited to 'includes/export/WikiExporter.php')
-rw-r--r-- | includes/export/WikiExporter.php | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/includes/export/WikiExporter.php b/includes/export/WikiExporter.php index fbcf8320703a..120632c365e9 100644 --- a/includes/export/WikiExporter.php +++ b/includes/export/WikiExporter.php @@ -63,12 +63,16 @@ class WikiExporter { /** @var DumpOutput */ public $sink; + /** @var XmlDumpWriter */ + private $writer; + /** - * Returns the export schema version. + * Returns the default export schema version, as defined by $wgXmlDumpSchemaVersion. * @return string */ public static function schemaVersion() { - return "0.10"; + global $wgXmlDumpSchemaVersion; + return $wgXmlDumpSchemaVersion; } /** @@ -83,12 +87,21 @@ class WikiExporter { function __construct( $db, $history = self::CURRENT, $text = self::TEXT ) { $this->db = $db; $this->history = $history; - $this->writer = new XmlDumpWriter(); + $this->writer = new XmlDumpWriter( $text, self::schemaVersion() ); $this->sink = new DumpOutput(); $this->text = $text; } /** + * @param string $schemaVersion which schema version the generated XML should comply to. + * One of the values from self::$supportedSchemas, using the XML_DUMP_SCHEMA_VERSION_XX + * constants. + */ + public function setSchemaVersion( $schemaVersion ) { + $this->writer = new XmlDumpWriter( $this->text, $schemaVersion ); + } + + /** * Set the DumpOutput or DumpFilter object which will receive * various row objects and XML output for filtering. Filters * can be chained or used as callbacks. |