* @return string
*/
function openStream() {
- global $wgLanguageCode;
+ global $wgContLang;
$ver = WikiExporter::schemaVersion();
return Xml::element( 'mediawiki', [
'xmlns' => "http://www.mediawiki.org/xml/export-$ver/",
'xsi:schemaLocation' => "http://www.mediawiki.org/xml/export-$ver/ " .
"http://www.mediawiki.org/xml/export-$ver.xsd",
'version' => $ver,
- 'xml:lang' => $wgLanguageCode ],
+ 'xml:lang' => $wgContLang->getHtmlCode() ],
null ) .
"\n" .
$this->siteInfo();
* @access private
*/
function writeRevision( $row ) {
-
$out = " <revision>\n";
$out .= " " . Xml::element( 'id', null, strval( $row->rev_id ) ) . "\n";
if ( isset( $row->rev_parent_id ) && $row->rev_parent_id ) {
}
if ( isset( $row->rev_deleted ) && ( $row->rev_deleted & Revision::DELETED_COMMENT ) ) {
$out .= " " . Xml::element( 'comment', [ 'deleted' => 'deleted' ] ) . "\n";
- } elseif ( $row->rev_comment != '' ) {
- $out .= " " . Xml::elementClean( 'comment', [], strval( $row->rev_comment ) ) . "\n";
+ } else {
+ $comment = CommentStore::newKey( 'rev_comment' )->getComment( $row )->text;
+ if ( $comment != '' ) {
+ $out .= " " . Xml::elementClean( 'comment', [], strval( $comment ) ) . "\n";
+ }
}
if ( isset( $row->rev_content_model ) && !is_null( $row->rev_content_model ) ) {
$out .= " <sha1/>\n";
}
- Hooks::run( 'XmlDumpWriterWriteRevision', [ &$this, &$out, $row, $text ] );
+ // Avoid PHP 7.1 warning from passing $this by reference
+ $writer = $this;
+ Hooks::run( 'XmlDumpWriterWriteRevision', [ &$writer, &$out, $row, $text ] );
$out .= " </revision>\n";
* @access private
*/
function writeLogItem( $row ) {
-
$out = " <logitem>\n";
$out .= " " . Xml::element( 'id', null, strval( $row->log_id ) ) . "\n";
if ( $row->log_deleted & LogPage::DELETED_COMMENT ) {
$out .= " " . Xml::element( 'comment', [ 'deleted' => 'deleted' ] ) . "\n";
- } elseif ( $row->log_comment != '' ) {
- $out .= " " . Xml::elementClean( 'comment', null, strval( $row->log_comment ) ) . "\n";
+ } else {
+ $comment = CommentStore::newKey( 'log_comment' )->getComment( $row )->text;
+ if ( $comment != '' ) {
+ $out .= " " . Xml::elementClean( 'comment', null, strval( $comment ) ) . "\n";
+ }
}
$out .= " " . Xml::element( 'type', null, strval( $row->log_type ) ) . "\n";
if ( $file->isDeleted( File::DELETED_COMMENT ) ) {
$comment = Xml::element( 'comment', [ 'deleted' => 'deleted' ] );
} else {
- $comment = Xml::elementClean( 'comment', null, $file->getDescription() );
+ $comment = Xml::elementClean( 'comment', null, strval( $file->getDescription() ) );
}
return " <upload>\n" .
$this->writeTimestamp( $file->getTimestamp() ) .
global $wgContLang;
$prefix = $wgContLang->getFormattedNsText( $title->getNamespace() );
+ // @todo Emit some kind of warning to the user if $title->getNamespace() !==
+ // NS_MAIN and $prefix === '' (viz. pages in an unregistered namespace)
+
if ( $prefix !== '' ) {
$prefix .= ':';
}