X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fexport%2FWikiExporter.php;h=e02cd8347c58343cde661cf336dee7363d9a4961;hb=a38af7ba26579bb3004f673e44d39710887763aa;hp=52e38a0e832faaa683047c4e7be54c1090c96f7b;hpb=8b26fc816ff5518726db80f518ad08460845ec6e;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/export/WikiExporter.php b/includes/export/WikiExporter.php index 52e38a0e83..e02cd8347c 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,11 +87,20 @@ 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 @@ -322,10 +335,7 @@ class WikiExporter { } $revOpts = [ 'page' ]; - if ( $this->text != self::STUB ) { - // TODO: remove the text and make XmlDumpWriter use a RevisionStore instead! (T198706) - $revOpts[] = 'text'; - } + $revQuery = Revision::getQueryInfo( $revOpts ); // We want page primary rather than revision @@ -335,8 +345,12 @@ class WikiExporter { ]; unset( $join['page'] ); - // TODO: remove rev_text_id and make XmlDumpWriter use a RevisionStore instead! (T198706) - $fields = array_merge( $revQuery['fields'], [ 'page_restrictions, rev_text_id' ] ); + $fields = $revQuery['fields']; + $fields[] = 'page_restrictions'; + + if ( $this->text != self::STUB ) { + $fields['_load_content'] = '1'; + } $conds = []; if ( $cond !== '' ) { @@ -455,8 +469,8 @@ class WikiExporter { protected function outputPageStreamBatch( $results, $lastRow ) { foreach ( $results as $row ) { if ( $lastRow === null || - $lastRow->page_namespace != $row->page_namespace || - $lastRow->page_title != $row->page_title ) { + $lastRow->page_namespace !== $row->page_namespace || + $lastRow->page_title !== $row->page_title ) { if ( $lastRow !== null ) { $output = ''; if ( $this->dumpUploads ) {