* @ingroup SpecialPage Dump
*/
class WikiExporter {
- var $list_authors = false; # Return distinct author list (when not returning full history)
- var $author_list = "";
+ /** @var bool Return distinct author list (when not returning full history) */
+ public $list_authors = false;
- var $dumpUploads = false;
- var $dumpUploadFileContents = false;
+ /** @var bool */
+ public $dumpUploads = false;
+
+ /** @var bool */
+ public $dumpUploadFileContents = false;
+
+ /** @var string */
+ protected $author_list = "";
const FULL = 1;
const CURRENT = 2;
const TEXT = 0;
const STUB = 1;
- var $buffer;
+ /** @var int */
+ protected $buffer;
- var $text;
+ /** @var int */
+ protected $text;
- /**
- * @var DumpOutput
- */
- var $sink;
+ /** @var DumpOutput */
+ protected $sink;
/**
* Returns the export schema version.
$out .= " " . Xml::elementClean( 'comment', array(), strval( $row->rev_comment ) ) . "\n";
}
+ if ( isset( $row->rev_content_model ) && !is_null( $row->rev_content_model ) ) {
+ $content_model = strval( $row->rev_content_model );
+ } else {
+ // probably using $wgContentHandlerUseDB = false;
+ $title = Title::makeTitle( $row->page_namespace, $row->page_title );
+ $content_model = ContentHandler::getDefaultModelFor( $title );
+ }
+
+ $content_handler = ContentHandler::getForModelID( $content_model );
+
+ if ( isset( $row->rev_content_format ) && !is_null( $row->rev_content_format ) ) {
+ $content_format = strval( $row->rev_content_format );
+ } else {
+ // probably using $wgContentHandlerUseDB = false;
+ $content_format = $content_handler->getDefaultFormat();
+ }
+
$text = '';
if ( isset( $row->rev_deleted ) && ( $row->rev_deleted & Revision::DELETED_TEXT ) ) {
$out .= " " . Xml::element( 'text', array( 'deleted' => 'deleted' ) ) . "\n";
} elseif ( isset( $row->old_text ) ) {
// Raw text from the database may have invalid chars
$text = strval( Revision::getRevisionText( $row ) );
+ $text = $content_handler->exportTransform( $text, $content_format );
$out .= " " . Xml::elementClean( 'text',
array( 'xml:space' => 'preserve', 'bytes' => intval( $row->rev_len ) ),
strval( $text ) ) . "\n";
$out .= " <sha1/>\n";
}
- if ( isset( $row->rev_content_model ) && !is_null( $row->rev_content_model ) ) {
- $content_model = strval( $row->rev_content_model );
- } else {
- // probably using $wgContentHandlerUseDB = false;
- // @todo test!
- $title = Title::makeTitle( $row->page_namespace, $row->page_title );
- $content_model = ContentHandler::getDefaultModelFor( $title );
- }
-
$out .= " " . Xml::element( 'model', null, strval( $content_model ) ) . "\n";
-
- if ( isset( $row->rev_content_format ) && !is_null( $row->rev_content_format ) ) {
- $content_format = strval( $row->rev_content_format );
- } else {
- // probably using $wgContentHandlerUseDB = false;
- // @todo test!
- $content_handler = ContentHandler::getForModelID( $content_model );
- $content_format = $content_handler->getDefaultFormat();
- }
-
$out .= " " . Xml::element( 'format', null, strval( $content_format ) ) . "\n";
wfRunHooks( 'XmlDumpWriterWriteRevision', array( &$this, &$out, $row, $text ) );
}
}
}
-
}
/**
* @ingroup Dump
*/
class DumpGZipOutput extends DumpPipeOutput {
-
/**
* @param string $file
*/
* @ingroup Dump
*/
class DumpBZip2Output extends DumpPipeOutput {
-
/**
* @param string $file
*/
* @ingroup Dump
*/
class Dump7ZipOutput extends DumpPipeOutput {
-
/**
* @param string $file
*/
* @ingroup Dump
*/
class DumpFilter {
-
/**
* @var DumpOutput
* FIXME will need to be made protected whenever legacy code
* @ingroup Dump
*/
class DumpNotalkFilter extends DumpFilter {
-
/**
* @param object $page
* @return bool
* @ingroup Dump
*/
class DumpNamespaceFilter extends DumpFilter {
- var $invert = false;
- var $namespaces = array();
+ /** @var bool */
+ protected $invert = false;
+
+ /** @var array */
+ protected $namespaces = array();
/**
* @param DumpOutput $sink
* @ingroup Dump
*/
class DumpLatestFilter extends DumpFilter {
- var $page, $pageString, $rev, $revString;
+ protected $page;
+
+ protected $pageString;
+
+ protected $rev;
+
+ protected $revString;
/**
* @param object $page
}
return $filenames;
}
-
}
/**
* @param string $string
* @return string
+ * @todo FIXME: Only used in OAI extension. Move over there.
*/
function xmlsafe( $string ) {
wfProfileIn( __FUNCTION__ );