MediaWiki  master
XmlDumpWriter Class Reference
Collaboration diagram for XmlDumpWriter:

Public Member Functions

 caseSetting ()
 
 closePage ()
 Closes a "<page>" section on the output stream. More...
 
 closeStream ()
 Closes the output stream with the closing root element. More...
 
 dbname ()
 
 generator ()
 
 homelink ()
 
 namespaces ()
 
 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...
 
 siteInfo ()
 
 sitename ()
 
 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)
 Dumps a "<revision>" section on the output stream, with data filled in from the given database row. More...
 
 writeTimestamp ( $timestamp, $indent=" ")
 
 writeUpload ( $file, $dumpContents=false)
 
 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...
 

Static Public Attributes

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

Private Member Functions

 getBlobStore ()
 
 getRevisionStore ()
 

Private Attributes

Title null $currentTitle = null
 Title of the currently processed page. More...
 

Detailed Description

Definition at line 32 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 530 of file XmlDumpWriter.php.

References Title\getNamespace(), Title\getPrefixedText(), Title\getText(), and Title\isExternal().

◆ caseSetting()

XmlDumpWriter::caseSetting ( )
Returns
string

Definition at line 132 of file XmlDumpWriter.php.

References $wgCapitalLinks, and Xml\element().

Referenced by siteInfo().

◆ closePage()

XmlDumpWriter::closePage ( )

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

Access:
private
Returns
string

Definition at line 211 of file XmlDumpWriter.php.

References null.

◆ closeStream()

XmlDumpWriter::closeStream ( )

Closes the output stream with the closing root element.

Call when finished dumping things.

Returns
string

Definition at line 167 of file XmlDumpWriter.php.

◆ dbname()

XmlDumpWriter::dbname ( )
Returns
string

Definition at line 109 of file XmlDumpWriter.php.

References $wgDBname, and Xml\element().

Referenced by siteInfo().

◆ generator()

XmlDumpWriter::generator ( )
Returns
string

Definition at line 117 of file XmlDumpWriter.php.

References $wgVersion, and Xml\element().

Referenced by siteInfo().

◆ getBlobStore()

XmlDumpWriter::getBlobStore ( )
private
Returns
SqlBlobStore

Definition at line 231 of file XmlDumpWriter.php.

Referenced by writeRevision().

◆ getRevisionStore()

XmlDumpWriter::getRevisionStore ( )
private
Returns
RevisionStore

Definition at line 224 of file XmlDumpWriter.php.

Referenced by writeRevision().

◆ homelink()

XmlDumpWriter::homelink ( )
Returns
string

Definition at line 125 of file XmlDumpWriter.php.

References Xml\element(), and Title\newMainPage().

Referenced by siteInfo().

◆ namespaces()

XmlDumpWriter::namespaces ( )
Returns
string

Definition at line 142 of file XmlDumpWriter.php.

References $title, as, and Xml\element().

Referenced by siteInfo().

◆ openPage()

XmlDumpWriter::openPage (   $row)

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

Parameters
object$row
Returns
string

Definition at line 178 of file XmlDumpWriter.php.

References $out, Xml\element(), Xml\elementClean(), WikiPage\factory(), Title\makeTitle(), and Hooks\run().

◆ 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 58 of file XmlDumpWriter.php.

References Xml\element(), null, WikiExporter\schemaVersion(), and siteInfo().

◆ siteInfo()

XmlDumpWriter::siteInfo ( )
Returns
string

Definition at line 85 of file XmlDumpWriter.php.

References caseSetting(), dbname(), generator(), homelink(), namespaces(), and sitename().

Referenced by openStream().

◆ sitename()

XmlDumpWriter::sitename ( )
Returns
string

Definition at line 101 of file XmlDumpWriter.php.

References $wgSitename, and Xml\element().

Referenced by siteInfo().

◆ writeContributor()

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

Definition at line 444 of file XmlDumpWriter.php.

References $out, Xml\element(), Xml\elementClean(), IP\isValid(), and null.

Referenced by writeLogItem(), writeRevision(), and writeUpload().

◆ writeLogItem()

XmlDumpWriter::writeLogItem (   $row)

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

Parameters
object$row
Returns
string
Access:
private

Definition at line 389 of file XmlDumpWriter.php.

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

◆ writeRevision()

XmlDumpWriter::writeRevision (   $row)

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

Parameters
object$row
Returns
string
Access:
private

Definition at line 243 of file XmlDumpWriter.php.

References $content, $out, $rev, Revision\DELETED_COMMENT, Revision\DELETED_TEXT, Revision\DELETED_USER, Xml\element(), Xml\elementClean(), getBlobStore(), ContentHandler\getDefaultModelFor(), ContentHandler\getForModelID(), getRevisionStore(), Revision\getRevisionText(), CommentStore\getStore(), null, Hooks\run(), wfLogWarning(), writeContributor(), and writeTimestamp().

◆ writeTimestamp()

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

Definition at line 433 of file XmlDumpWriter.php.

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

Referenced by writeLogItem(), writeRevision(), and writeUpload().

◆ writeUpload()

XmlDumpWriter::writeUpload (   $file,
  $dumpContents = false 
)
Parameters
File$file
bool$dumpContents
Returns
string

Definition at line 482 of file XmlDumpWriter.php.

References $file, File\DELETED_COMMENT, Xml\element(), Xml\elementClean(), null, writeContributor(), and writeTimestamp().

Referenced by writeUploads().

◆ writeUploads()

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

Warning! This data is potentially inconsistent.

:(

Parameters
object$row
bool$dumpContents
Returns
string

Definition at line 462 of file XmlDumpWriter.php.

References $out, as, NS_FILE, wfLocalFile(), and writeUpload().

Member Data Documentation

◆ $currentTitle

Title null XmlDumpWriter::$currentTitle = null
private

Title of the currently processed page.

Definition at line 46 of file XmlDumpWriter.php.

◆ $supportedSchemas

string [] XmlDumpWriter::$supportedSchemas
static
Initial value:

the schema versions supported for output

Definition at line 37 of file XmlDumpWriter.php.

Referenced by BackupDumper\processOptions(), and MediaWiki\Tests\Maintenance\BackupDumperPageTest\schemaVersionProvider().


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