MediaWiki  master
XmlDumpWriter Class Reference

Public Member Functions

 __construct ( $contentMode=self::WRITE_CONTENT, $schemaVersion=XML_DUMP_SCHEMA_VERSION_11)
 
 closePage ()
 Closes a "<page>" section on the output stream. More...
 
 closeStream ()
 Closes the output stream with the closing root element. More...
 
 openPage ( $row)
 Opens a "<page>" section on the output stream, with data from the given database row. More...
 
 openStream ()
 Opens the XML output stream's root "<mediawiki>" element. More...
 
 writeContributor ( $id, $text, $indent=" ")
 
 writeLogItem ( $row)
 Dumps a "<logitem>" section on the output stream, with data filled in from the given database row. More...
 
 writeRevision ( $row, $slotRows=null)
 Dumps a "<revision>" section on the output stream, with data filled in from the given database row. More...
 
 writeTimestamp ( $timestamp, $indent=" ")
 
 writeUploads ( $row, $dumpContents=false)
 Warning! This data is potentially inconsistent. More...
 

Static Public Member Functions

static canonicalTitle (Title $title)
 Return prefixed text form of title, but using the content language's canonical namespace. More...
 

Public Attributes

const WRITE_CONTENT = 0
 Output serialized revision content. More...
 
const WRITE_STUB = 1
 Only output subs for revision content. More...
 

Static Public Attributes

static string[] $supportedSchemas
 the schema versions supported for output @final More...
 

Detailed Description

Definition at line 40 of file XmlDumpWriter.php.

Constructor & Destructor Documentation

◆ __construct()

XmlDumpWriter::__construct (   $contentMode = self::WRITE_CONTENT,
  $schemaVersion = XML_DUMP_SCHEMA_VERSION_11 
)
Parameters
int$contentModeWRITE_CONTENT or WRITE_STUB.
string$schemaVersionwhich schema version the generated XML should comply to. One of the values from self::$supportedSchemas, using the XML_DUMP_SCHEMA_VERSION_XX constants.

Definition at line 91 of file XmlDumpWriter.php.

Member Function Documentation

◆ canonicalTitle()

static XmlDumpWriter::canonicalTitle ( Title  $title)
static

Return prefixed text form of title, but using the content language's canonical namespace.

This skips any special-casing such as gendered user namespaces – which while useful, are not yet listed in the XML "<siteinfo>" data so are unsafe in export.

Parameters
Title$title
Returns
string
Since
1.18

Definition at line 732 of file XmlDumpWriter.php.

References $title.

Referenced by openPage().

◆ closePage()

XmlDumpWriter::closePage ( )

Closes a "<page>" section on the output stream.

Access: internal
Returns
string

Definition at line 278 of file XmlDumpWriter.php.

◆ closeStream()

XmlDumpWriter::closeStream ( )

Closes the output stream with the closing root element.

Call when finished dumping things.

Returns
string

Definition at line 233 of file XmlDumpWriter.php.

◆ openPage()

XmlDumpWriter::openPage (   $row)

Opens a "<page>" section on the output stream, with data from the given database row.

Parameters
stdClass$row
Returns
string

Definition at line 244 of file XmlDumpWriter.php.

References canonicalTitle(), Xml\element(), Xml\elementClean(), Title\isValidRedirectTarget(), and Title\newFromRow().

◆ openStream()

XmlDumpWriter::openStream ( )

Opens the XML output stream's root "<mediawiki>" element.

This does not include an xml directive, so is safe to include as a subelement in a larger XML stream. Namespace and XML Schema references are included.

Output will be encoded in UTF-8.

Returns
string

Definition at line 123 of file XmlDumpWriter.php.

References Xml\element().

◆ writeContributor()

XmlDumpWriter::writeContributor (   $id,
  $text,
  $indent = "      " 
)
Parameters
int$id
string$text
string$indentDefault to six spaces
Returns
string

Definition at line 636 of file XmlDumpWriter.php.

References Xml\element(), and Xml\elementClean().

Referenced by writeLogItem(), and writeRevision().

◆ writeLogItem()

XmlDumpWriter::writeLogItem (   $row)

Dumps a "<logitem>" section on the output stream, with data filled in from the given database row.

Parameters
stdClass$row
Returns
string

Definition at line 581 of file XmlDumpWriter.php.

References $title, LogPage\DELETED_ACTION, LogPage\DELETED_COMMENT, LogPage\DELETED_USER, Xml\element(), Xml\elementClean(), CommentStore\getStore(), Title\makeTitle(), writeContributor(), and writeTimestamp().

◆ writeRevision()

XmlDumpWriter::writeRevision (   $row,
  $slotRows = null 
)

Dumps a "<revision>" section on the output stream, with data filled in from the given database row.

Parameters
stdClass$row
null | stdClass[]$slotRows
Returns
string
Exceptions
FatalError
MWException

Definition at line 341 of file XmlDumpWriter.php.

References $content, Xml\element(), Xml\elementClean(), writeContributor(), and writeTimestamp().

◆ writeTimestamp()

XmlDumpWriter::writeTimestamp (   $timestamp,
  $indent = "      " 
)
Parameters
string$timestamp
string$indentDefault to six spaces
Returns
string

Definition at line 625 of file XmlDumpWriter.php.

References Xml\element(), and wfTimestamp().

Referenced by writeLogItem(), and writeRevision().

◆ writeUploads()

XmlDumpWriter::writeUploads (   $row,
  $dumpContents = false 
)

Warning! This data is potentially inconsistent.

:(

Parameters
stdClass$row
bool$dumpContents
Returns
string

Definition at line 654 of file XmlDumpWriter.php.

References NS_FILE.

Member Data Documentation

◆ $supportedSchemas

string [] XmlDumpWriter::$supportedSchemas
static
Initial value:
= [
]
const XML_DUMP_SCHEMA_VERSION_11
Definition: Defines.php:317
const XML_DUMP_SCHEMA_VERSION_10
Definition: Defines.php:316

the schema versions supported for output @final

Definition at line 58 of file XmlDumpWriter.php.

Referenced by ApiQuery\getAllowedParams(), and BackupDumper\processOptions().

◆ WRITE_CONTENT

const XmlDumpWriter::WRITE_CONTENT = 0

Output serialized revision content.

Definition at line 43 of file XmlDumpWriter.php.

Referenced by TextPassDumper\dump().

◆ WRITE_STUB

const XmlDumpWriter::WRITE_STUB = 1

Only output subs for revision content.

Definition at line 46 of file XmlDumpWriter.php.


The documentation for this class was generated from the following file: