MediaWiki
1.34.0
|
Public Member Functions | |
__construct ( $contentMode=self::WRITE_CONTENT, $schemaVersion=XML_DUMP_SCHEMA_VERSION_11) | |
XmlDumpWriter constructor. More... | |
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, $slotRows=null) | |
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... | |
Public Attributes | |
const | WRITE_CONTENT = 0 |
Output serialized revision content. More... | |
const | WRITE_STUB = 1 |
Only output subs for revision content. More... | |
const | WRITE_STUB_DELETED = 2 |
Only output subs for revision content, indicating that the content has been deleted/suppressed. More... | |
Static Public Attributes | |
static string[] | $supportedSchemas |
the schema versions supported for output @final More... | |
Private Member Functions | |
getBlobStore () | |
getRevisionStore () | |
invokeLenient ( $obj, $method, $args=[], $warning) | |
Invokes the given method on the given object, catching and logging any storage related exceptions. More... | |
writeSlot (SlotRecord $slot, $contentMode) | |
writeText (Content $content, $textAttributes, $indent) | |
Private Attributes | |
int | $contentMode |
Whether to output revision content or just stubs. More... | |
Title null | $currentTitle = null |
Title of the currently processed page. More... | |
string | $schemaVersion |
which schema version the generated XML should comply to. More... | |
Definition at line 36 of file XmlDumpWriter.php.
XmlDumpWriter::__construct | ( | $contentMode = self::WRITE_CONTENT , |
|
$schemaVersion = XML_DUMP_SCHEMA_VERSION_11 |
|||
) |
XmlDumpWriter constructor.
int | $contentMode | WRITE_CONTENT or WRITE_STUB. |
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. |
Definition at line 86 of file XmlDumpWriter.php.
References $contentMode, and $schemaVersion.
|
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.
Title | $title |
Definition at line 709 of file XmlDumpWriter.php.
References $title.
Referenced by openPage().
XmlDumpWriter::caseSetting | ( | ) |
Definition at line 191 of file XmlDumpWriter.php.
References $wgCapitalLinks, and Xml\element().
Referenced by siteInfo().
XmlDumpWriter::closePage | ( | ) |
Closes a "<page>" section on the output stream.
Definition at line 270 of file XmlDumpWriter.php.
XmlDumpWriter::closeStream | ( | ) |
Closes the output stream with the closing root element.
Call when finished dumping things.
Definition at line 226 of file XmlDumpWriter.php.
XmlDumpWriter::dbname | ( | ) |
Definition at line 168 of file XmlDumpWriter.php.
References $wgDBname, and Xml\element().
Referenced by siteInfo().
XmlDumpWriter::generator | ( | ) |
Definition at line 176 of file XmlDumpWriter.php.
References $wgVersion, and Xml\element().
Referenced by siteInfo().
|
private |
|
private |
Definition at line 283 of file XmlDumpWriter.php.
Referenced by writeRevision().
XmlDumpWriter::homelink | ( | ) |
Definition at line 184 of file XmlDumpWriter.php.
References Xml\element(), and Title\newMainPage().
Referenced by siteInfo().
|
private |
Invokes the given method on the given object, catching and logging any storage related exceptions.
object | $obj | |
string | $method | |
array | $args | |
string | $warning | The warning to output in case of a storage related exception. |
Exception |
Definition at line 307 of file XmlDumpWriter.php.
References $args, and MWDebug\warning().
Referenced by writeRevision(), and writeSlot().
XmlDumpWriter::namespaces | ( | ) |
Definition at line 201 of file XmlDumpWriter.php.
References $title, and Xml\element().
Referenced by siteInfo().
XmlDumpWriter::openPage | ( | $row | ) |
Opens a "<page>" section on the output stream, with data from the given database row.
object | $row |
Definition at line 237 of file XmlDumpWriter.php.
References canonicalTitle(), Xml\element(), Xml\elementClean(), WikiPage\factory(), Title\isValidRedirectTarget(), Title\newFromRow(), and Hooks\run().
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.
Definition at line 117 of file XmlDumpWriter.php.
References $schemaVersion, Xml\element(), and siteInfo().
XmlDumpWriter::siteInfo | ( | ) |
Definition at line 144 of file XmlDumpWriter.php.
References caseSetting(), dbname(), generator(), homelink(), namespaces(), and sitename().
Referenced by openStream().
XmlDumpWriter::sitename | ( | ) |
Definition at line 160 of file XmlDumpWriter.php.
References $wgSitename, and Xml\element().
Referenced by siteInfo().
XmlDumpWriter::writeContributor | ( | $id, | |
$text, | |||
$indent = " " |
|||
) |
int | $id | |
string | $text | |
string | $indent | Default to six spaces |
Definition at line 620 of file XmlDumpWriter.php.
References Xml\element(), Xml\elementClean(), and IP\isValid().
Referenced by writeLogItem(), writeRevision(), and writeUpload().
XmlDumpWriter::writeLogItem | ( | $row | ) |
Dumps a "<logitem>" section on the output stream, with data filled in from the given database row.
object | $row |
Definition at line 565 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().
XmlDumpWriter::writeRevision | ( | $row, | |
$slotRows = null |
|||
) |
Dumps a "<revision>" section on the output stream, with data filled in from the given database row.
object | $row | |
null | object[] | $slotRows |
FatalError | |
MWException |
Definition at line 335 of file XmlDumpWriter.php.
References $content, $contentMode, Xml\element(), Xml\elementClean(), getRevisionStore(), invokeLenient(), Hooks\run(), WRITE_STUB_DELETED, writeContributor(), writeSlot(), and writeTimestamp().
|
private |
SlotRecord | $slot | |
int | $contentMode | see the WRITE_XXX constants |
Definition at line 422 of file XmlDumpWriter.php.
References $content, $contentMode, Xml\closeElement(), Xml\element(), Revision\SlotRecord\getAddress(), getBlobStore(), ContentHandler\getForModelID(), Revision\SlotRecord\getModel(), Revision\SlotRecord\getOrigin(), Revision\SlotRecord\getRevision(), Revision\SlotRecord\getRole(), invokeLenient(), Xml\openElement(), MWDebug\warning(), writeText(), and XML_DUMP_SCHEMA_VERSION_11.
Referenced by writeRevision().
|
private |
Content | $content | |
string[] | $textAttributes | |
string | $indent |
Definition at line 536 of file XmlDumpWriter.php.
References $content, and Xml\elementClean().
Referenced by writeSlot().
XmlDumpWriter::writeTimestamp | ( | $timestamp, | |
$indent = " " |
|||
) |
string | $timestamp | |
string | $indent | Default to six spaces |
Definition at line 609 of file XmlDumpWriter.php.
References Xml\element(), and wfTimestamp().
Referenced by writeLogItem(), writeRevision(), and writeUpload().
XmlDumpWriter::writeUpload | ( | $file, | |
$dumpContents = false |
|||
) |
File | $file | |
bool | $dumpContents |
Definition at line 659 of file XmlDumpWriter.php.
References $file, File\DELETED_COMMENT, Xml\element(), Xml\elementClean(), writeContributor(), and writeTimestamp().
Referenced by writeUploads().
XmlDumpWriter::writeUploads | ( | $row, | |
$dumpContents = false |
|||
) |
Warning! This data is potentially inconsistent.
:(
object | $row | |
bool | $dumpContents |
Definition at line 638 of file XmlDumpWriter.php.
References NS_FILE, and writeUpload().
|
private |
Whether to output revision content or just stubs.
WRITE_CONTENT or WRITE_STUB.
Definition at line 76 of file XmlDumpWriter.php.
Referenced by __construct(), writeRevision(), and writeSlot().
|
private |
Title of the currently processed page.
Definition at line 71 of file XmlDumpWriter.php.
|
private |
which schema version the generated XML should comply to.
One of the values from self::$supportedSchemas, using the SCHEMA_VERSION_XX constants.
Definition at line 64 of file XmlDumpWriter.php.
Referenced by __construct(), and openStream().
|
static |
the schema versions supported for output @final
Definition at line 54 of file XmlDumpWriter.php.
Referenced by ApiQuery\getAllowedParams(), and BackupDumper\processOptions().
const XmlDumpWriter::WRITE_CONTENT = 0 |
Output serialized revision content.
Definition at line 39 of file XmlDumpWriter.php.
Referenced by TextPassDumper\dump().
const XmlDumpWriter::WRITE_STUB = 1 |
Only output subs for revision content.
Definition at line 42 of file XmlDumpWriter.php.
const XmlDumpWriter::WRITE_STUB_DELETED = 2 |
Only output subs for revision content, indicating that the content has been deleted/suppressed.
For internal use only.
Definition at line 48 of file XmlDumpWriter.php.
Referenced by writeRevision().