45 while ( $this->xml->read() ) {
46 if ( $this->xml->nodeType == XMLReader::END_ELEMENT &&
47 $this->xml->name == $name
68 "Skipping to end of $name" );
69 while ( $this->xml->read() ) {
70 if ( $this->xml->nodeType == XMLReader::ELEMENT ) {
86 $this->xml =
new XMLReader();
88 Assert::assertTrue( $this->xml->open(
$fname ),
89 "Opening temporary file $fname via XMLReader failed" );
90 if ( $skip_siteinfo ) {
92 "Skipping past end of siteinfo" );
105 if ( $this->xml->read() ) {
108 Assert::assertEquals( $this->xml->nodeType, XMLReader::NONE,
109 "No proper entity left to parse" );
118 while ( $cont && ( ( $this->xml->nodeType == XMLReader::WHITESPACE )
119 || ( $this->xml->nodeType == XMLReader::SIGNIFICANT_WHITESPACE ) ) ) {
120 $cont = $this->xml->read();
133 Assert::assertEquals( $name, $this->xml->name,
"Node name" );
134 Assert::assertEquals( XMLReader::ELEMENT, $this->xml->nodeType,
"Node type" );
136 Assert::assertTrue( $this->xml->read(),
"Skipping past start tag" );
149 Assert::assertEquals( $name, $this->xml->name,
"Node name" );
150 Assert::assertEquals( XMLReader::END_ELEMENT, $this->xml->nodeType,
"Node type" );
152 Assert::assertTrue( $this->xml->read(),
"Skipping past end tag" );
170 if ( $text !==
false ) {
171 Assert::assertEquals( $text, $this->xml->value,
"Text of node " . $name );
173 Assert::assertTrue( $this->xml->read(),
"Skipping past processed text of " . $name );
227 $text_sha1, $text =
false, $parentid =
false,
234 if ( $parentid !==
false ) {
255 if ( $this->xml->name ==
"text" ) {
258 $this->
assertText( $id, $text_id, $text_bytes, $text );
265 if ( !$text_found ) {
266 $this->
assertText( $id, $text_id, $text_bytes, $text );
273 public function assertText( $id, $text_id, $text_bytes, $text ) {
275 if ( $text_bytes !==
false ) {
276 Assert::assertEquals( $this->xml->getAttribute(
"bytes" ), $text_bytes,
277 "Attribute 'bytes' of revision " . $id );
280 if ( $text ===
false ) {
282 Assert::assertEquals( $this->xml->getAttribute(
"id" ), $text_id,
283 "Text id of revision " . $id );
284 Assert::assertFalse( $this->xml->hasValue,
"Revision has text" );
285 Assert::assertTrue( $this->xml->read(),
"Skipping text start tag" );
286 if ( ( $this->xml->nodeType == XMLReader::END_ELEMENT )
287 && ( $this->xml->name ==
"text" )
294 Assert::assertTrue( $this->xml->read(),
"Skipping text start tag" );
295 Assert::assertEquals( $text, $this->xml->value,
"Text of revision " . $id );
296 Assert::assertTrue( $this->xml->read(),
"Skipping past text" );
316 $subtype, $title, $parameters = []
331 if ( $comment !==
null ) {
339 $parameters_xml =
unserialize( $this->xml->value );
340 Assert::assertEquals( $parameters, $parameters_xml );
341 Assert::assertTrue( $this->xml->read(),
"Skipping past processed text of params" );
unserialize( $serialized)
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
if(defined( 'MW_SETUP_CALLBACK')) $fname
Customization point after all loading (constants, functions, classes, DefaultSettings,...
Helper for asserting the structure of an XML dump stream.
assertLogItem( $id, $user_name, $user_id, $comment, $type, $subtype, $title, $parameters=[])
asserts that the xml reader is at the beginning of a log entry and skips over it while analyzing it.
assertNodeEnd( $name, $skip=true)
Asserts that the xml reader is at an closing element of given name, and optionally skips past it.
skipWhitespace()
Steps the xml reader over white space.
XMLReader null $xml
Holds the XMLReader used for analyzing an XML dump.
skipPastNodeEnd( $name)
Step the current XML reader to the first element start after the node end of a given name.
assertPageStart( $id, $ns, $name)
Asserts that the xml reader is at the start of a page element and skips over the first tags,...
assertDumpEnd( $name="mediawiki")
Asserts that the xml reader is at the final closing tag of an xml file and closes the reader.
assertText( $id, $text_id, $text_bytes, $text)
assertRevision( $id, $summary, $text_id, $text_bytes, $text_sha1, $text=false, $parentid=false, $model=CONTENT_MODEL_WIKITEXT, $format=CONTENT_FORMAT_WIKITEXT)
Asserts that the xml reader is at a revision and checks its representation before skipping over it.
assertDumpStart( $fname, $skip_siteinfo=true)
Opens an XML file to analyze and optionally skips past siteinfo.
skipToNodeEnd( $name)
Step the current XML reader until node end of given name is found.
string $schemaVersion
XML dump schema version.
assertPageEnd()
Asserts that the xml reader is at the page's closing element and skips to the next element.
assertNodeStart( $name, $skip=true)
Asserts that the xml reader is at an element of given name, and optionally skips past it.
__construct( $schemaVersion)
DumpAsserts constructor.
assertTextNode( $name, $text, $skip_ws=true)
Asserts that the xml reader is at an element of given tag that contains a given text,...
const CONTENT_MODEL_WIKITEXT
const CONTENT_FORMAT_WIKITEXT