/** @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;
}
/**
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
$opts[] = 'STRAIGHT_JOIN';
$opts['USE INDEX']['revision'] = 'rev_page_id';
unset( $join['revision'] );
- $join['page'] = [ 'INNER JOIN', 'rev_page=page_id' ];
+ $join['page'] = [ 'JOIN', 'rev_page=page_id' ];
}
} elseif ( $this->history & self::CURRENT ) {
# Latest revision dumps...
if ( $this->list_authors && $cond != '' ) { // List authors, if so desired
$this->do_list_authors( $cond );
}
- $join['revision'] = [ 'INNER JOIN', 'page_id=rev_page AND page_latest=rev_id' ];
+ $join['revision'] = [ 'JOIN', 'page_id=rev_page AND page_latest=rev_id' ];
} elseif ( $this->history & self::STABLE ) {
# "Stable" revision dumps...
# Default JOIN, to be overridden...
- $join['revision'] = [ 'INNER JOIN', 'page_id=rev_page AND page_latest=rev_id' ];
+ $join['revision'] = [ 'JOIN', 'page_id=rev_page AND page_latest=rev_id' ];
# One, and only one hook should set this, and return false
if ( Hooks::run( 'WikiExporter::dumpStableQuery', [ &$tables, &$opts, &$join ] ) ) {
throw new MWException( __METHOD__ . " given invalid history dump type." );
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 ) {