WikiExporter: Remove unnecessary check for SCHEMA_COMPAT_WRITE_OLD flag
[lhc/web/wiklou.git] / tests / phpunit / maintenance / backup_PageTest.php
1 <?php
2
3 namespace MediaWiki\Tests\Maintenance;
4
5 use DumpBackup;
6 use Exception;
7 use MediaWiki\MediaWikiServices;
8 use MediaWiki\Revision\RevisionRecord;
9 use MediaWiki\Revision\SlotRecord;
10 use MediaWikiTestCase;
11 use MWException;
12 use RequestContext;
13 use RevisionDeleter;
14 use Title;
15 use WikiExporter;
16 use Wikimedia\Rdbms\IDatabase;
17 use Wikimedia\Rdbms\LoadBalancer;
18 use WikiPage;
19 use XmlDumpWriter;
20
21 /**
22 * Tests for page dumps of BackupDumper
23 *
24 * @group Database
25 * @group Dump
26 * @covers BackupDumper
27 */
28 class BackupDumperPageTest extends DumpTestCase {
29
30 // We'll add several pages, revision and texts. The following variables hold the
31 // corresponding ids.
32 private $pageId1, $pageId2, $pageId3, $pageId4, $pageId5;
33 private $pageTitle1, $pageTitle2, $pageTitle3, $pageTitle4, $pageTitle5;
34 private $revId1_1, $textId1_1;
35 private $revId2_1, $textId2_1, $revId2_2, $textId2_2;
36 private $revId2_3, $textId2_3, $revId2_4, $textId2_4;
37 private $revId3_1, $textId3_1, $revId3_2, $textId3_2;
38 private $revId4_1, $textId4_1;
39 private $revId5_1, $textId5_1;
40 private $namespace, $talk_namespace;
41
42 /**
43 * @var LoadBalancer|null
44 */
45 private $streamingLoadBalancer = null;
46
47 function addDBData() {
48 // be sure, titles created here using english namespace names
49 $this->setContentLang( 'en' );
50
51 $this->tablesUsed[] = 'page';
52 $this->tablesUsed[] = 'revision';
53 $this->tablesUsed[] = 'ip_changes';
54 $this->tablesUsed[] = 'text';
55
56 try {
57 $this->namespace = $this->getDefaultWikitextNS();
58 $this->talk_namespace = NS_TALK;
59
60 if ( $this->namespace === $this->talk_namespace ) {
61 // @todo work around this.
62 throw new MWException( "The default wikitext namespace is the talk namespace. "
63 . " We can't currently deal with that." );
64 }
65
66 $this->pageTitle1 = Title::newFromText( 'BackupDumperTestP1', $this->namespace );
67 $page = WikiPage::factory( $this->pageTitle1 );
68 list( $this->revId1_1, $this->textId1_1 ) = $this->addRevision( $page,
69 "BackupDumperTestP1Text1", "BackupDumperTestP1Summary1" );
70 $this->pageId1 = $page->getId();
71
72 $this->pageTitle2 = Title::newFromText( 'BackupDumperTestP2', $this->namespace );
73 $page = WikiPage::factory( $this->pageTitle2 );
74 list( $this->revId2_1, $this->textId2_1 ) = $this->addRevision( $page,
75 "BackupDumperTestP2Text1", "BackupDumperTestP2Summary1" );
76 list( $this->revId2_2, $this->textId2_2 ) = $this->addRevision( $page,
77 "BackupDumperTestP2Text2", "BackupDumperTestP2Summary2" );
78 list( $this->revId2_3, $this->textId2_3 ) = $this->addRevision( $page,
79 "BackupDumperTestP2Text3", "BackupDumperTestP2Summary3" );
80 list( $this->revId2_4, $this->textId2_4 ) = $this->addRevision( $page,
81 "BackupDumperTestP2Text4 some additional Text ",
82 "BackupDumperTestP2Summary4 extra " );
83 $this->pageId2 = $page->getId();
84
85 $revDel = RevisionDeleter::createList(
86 'revision',
87 RequestContext::getMain(),
88 $this->pageTitle2,
89 [ $this->revId2_2 ]
90 );
91 $revDel->setVisibility( [
92 'value' => [ RevisionRecord::DELETED_TEXT => 1 ],
93 'comment' => 'testing!'
94 ] );
95
96 $this->pageTitle3 = Title::newFromText( 'BackupDumperTestP3', $this->namespace );
97 $page = WikiPage::factory( $this->pageTitle3 );
98 list( $this->revId3_1, $this->textId3_1 ) = $this->addRevision( $page,
99 "BackupDumperTestP3Text1", "BackupDumperTestP2Summary1" );
100 list( $this->revId3_2, $this->textId3_2 ) = $this->addRevision( $page,
101 "BackupDumperTestP3Text2", "BackupDumperTestP2Summary2" );
102 $this->pageId3 = $page->getId();
103 $page->doDeleteArticle( "Testing ;)" );
104
105 $this->pageTitle4 = Title::newFromText( 'BackupDumperTestP1', $this->talk_namespace );
106 $page = WikiPage::factory( $this->pageTitle4 );
107 list( $this->revId4_1, $this->textId4_1 ) = $this->addRevision( $page,
108 "Talk about BackupDumperTestP1 Text1",
109 "Talk BackupDumperTestP1 Summary1" );
110 $this->pageId4 = $page->getId();
111
112 $this->pageTitle5 = Title::newFromText( 'BackupDumperTestP5' );
113 $page = WikiPage::factory( $this->pageTitle5 );
114 list( $this->revId5_1, $this->textId5_1 ) = $this->addRevision( $page,
115 "BackupDumperTestP5 Text1",
116 "BackupDumperTestP5 Summary1" );
117 $this->pageId5 = $page->getId();
118
119 $this->corruptRevisionData( $page->getRevision()->getRevisionRecord() );
120 } catch ( Exception $e ) {
121 // We'd love to pass $e directly. However, ... see
122 // documentation of exceptionFromAddDBData in
123 // DumpTestCase
124 $this->exceptionFromAddDBData = $e;
125 }
126 }
127
128 /**
129 * Corrupt the information about the given revision in the database.
130 *
131 * @param RevisionRecord $revision
132 */
133 private function corruptRevisionData( RevisionRecord $revision ) {
134 global $wgMultiContentRevisionSchemaMigrationStage;
135
136 if ( ( $wgMultiContentRevisionSchemaMigrationStage & SCHEMA_COMPAT_WRITE_OLD ) ) {
137 $this->db->update(
138 'revision',
139 [ 'rev_text_id' => 0 ],
140 [ 'rev_id' => $revision->getId() ]
141 );
142 }
143
144 if ( ( $wgMultiContentRevisionSchemaMigrationStage & SCHEMA_COMPAT_WRITE_NEW ) ) {
145 $this->db->update(
146 'content',
147 [ 'content_address' => 'tt:0' ],
148 [ 'content_id' => $revision->getSlot( SlotRecord::MAIN )->getContentId() ]
149 );
150 }
151 }
152
153 protected function setUp() {
154 parent::setUp();
155
156 // Since we will restrict dumping by page ranges (to allow
157 // working tests, even if the db gets prepopulated by a base
158 // class), we have to assert, that the page id are consecutively
159 // increasing
160 $this->assertEquals(
161 [ $this->pageId2, $this->pageId3, $this->pageId4 ],
162 [ $this->pageId1 + 1, $this->pageId2 + 1, $this->pageId3 + 1 ],
163 "Page ids increasing without holes" );
164 }
165
166 function tearDown() {
167 parent::tearDown();
168
169 if ( isset( $this->streamingLoadBalancer ) ) {
170 $this->streamingLoadBalancer->closeAll();
171 }
172 }
173
174 /**
175 * Returns a new database connection which is separate from the conenctions returned
176 * by the default LoadBalancer instance.
177 *
178 * @return IDatabase
179 */
180 private function newStreamingDBConnection() {
181 // Create a *new* LoadBalancer, so no connections are shared
182 if ( !$this->streamingLoadBalancer ) {
183 $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
184
185 $this->streamingLoadBalancer = $lbFactory->newMainLB();
186 }
187
188 $db = $this->streamingLoadBalancer->getConnection( DB_REPLICA );
189
190 // Make sure the DB connection has the fake table clones and the fake table prefix
191 MediaWikiTestCase::setupDatabaseWithTestPrefix( $db );
192
193 // Make sure the DB connection has all the test data
194 $this->copyTestData( $this->db, $db );
195
196 return $db;
197 }
198
199 /**
200 * @param array $argv
201 * @param int $startId
202 * @param int $endId
203 *
204 * @return DumpBackup
205 */
206 private function newDumpBackup( $argv, $startId, $endId ) {
207 $dumper = new DumpBackup( $argv );
208 $dumper->startId = $startId;
209 $dumper->endId = $endId;
210 $dumper->reporting = false;
211
212 // NOTE: The copyTestData() method used by newStreamingDBConnection()
213 // doesn't work with SQLite (T217607).
214 // But DatabaseSqlite doesn't support streaming anyway, so just skip that part.
215 if ( $this->db->getType() === 'sqlite' ) {
216 $dumper->setDB( $this->db );
217 } else {
218 $dumper->setDB( $this->newStreamingDBConnection() );
219 }
220
221 return $dumper;
222 }
223
224 public function schemaVersionProvider() {
225 foreach ( XmlDumpWriter::$supportedSchemas as $schemaVersion ) {
226 yield [ $schemaVersion ];
227 }
228 }
229
230 /**
231 * @dataProvider schemaVersionProvider
232 */
233 function testFullTextPlain( $schemaVersion ) {
234 // Preparing the dump
235 $fname = $this->getNewTempFile();
236
237 $dumper = $this->newDumpBackup(
238 [ '--full', '--quiet', '--output', 'file:' . $fname, '--schema-version', $schemaVersion ],
239 $this->pageId1,
240 $this->pageId5 + 1
241 );
242
243 // Performing the dump. Suppress warnings, since we want to test
244 // accessing broken revision data (page 5).
245 $this->setMwGlobals( 'wgDevelopmentWarnings', false );
246 $dumper->execute();
247 $this->setMwGlobals( 'wgDevelopmentWarnings', true );
248
249 // Checking the dumped data
250 $this->assertDumpSchema( $fname, $this->getXmlSchemaPath( $schemaVersion ) );
251 $asserter = $this->getDumpAsserter( $schemaVersion );
252
253 $asserter->assertDumpStart( $fname );
254
255 // Page 1
256 $asserter->assertPageStart(
257 $this->pageId1,
258 $this->namespace,
259 $this->pageTitle1->getPrefixedText()
260 );
261 $asserter->assertRevision(
262 $this->revId1_1,
263 "BackupDumperTestP1Summary1",
264 $this->textId1_1,
265 23,
266 "0bolhl6ol7i6x0e7yq91gxgaan39j87",
267 "BackupDumperTestP1Text1"
268 );
269 $asserter->assertPageEnd();
270
271 // Page 2
272 $asserter->assertPageStart(
273 $this->pageId2,
274 $this->namespace,
275 $this->pageTitle2->getPrefixedText()
276 );
277 $asserter->assertRevision(
278 $this->revId2_1,
279 "BackupDumperTestP2Summary1",
280 $this->textId2_1,
281 23,
282 "jprywrymfhysqllua29tj3sc7z39dl2",
283 "BackupDumperTestP2Text1"
284 );
285 $asserter->assertRevision(
286 $this->revId2_2,
287 "BackupDumperTestP2Summary2",
288 null, // deleted!
289 false, // deleted!
290 null, // deleted!
291 false, // deleted!
292 $this->revId2_1
293 );
294 $asserter->assertRevision(
295 $this->revId2_3,
296 "BackupDumperTestP2Summary3",
297 $this->textId2_3,
298 23,
299 "jfunqmh1ssfb8rs43r19w98k28gg56r",
300 "BackupDumperTestP2Text3",
301 $this->revId2_2
302 );
303 $asserter->assertRevision(
304 $this->revId2_4,
305 "BackupDumperTestP2Summary4 extra",
306 $this->textId2_4,
307 44,
308 "6o1ciaxa6pybnqprmungwofc4lv00wv",
309 "BackupDumperTestP2Text4 some additional Text",
310 $this->revId2_3
311 );
312 $asserter->assertPageEnd();
313
314 // Page 3
315 // -> Page is marked deleted. Hence not visible
316
317 // Page 4
318 $asserter->assertPageStart(
319 $this->pageId4,
320 $this->talk_namespace,
321 $this->pageTitle4->getPrefixedText()
322 );
323 $asserter->assertRevision(
324 $this->revId4_1,
325 "Talk BackupDumperTestP1 Summary1",
326 $this->textId4_1,
327 35,
328 "nktofwzd0tl192k3zfepmlzxoax1lpe",
329 "Talk about BackupDumperTestP1 Text1",
330 false,
331 CONTENT_MODEL_WIKITEXT,
332 CONTENT_FORMAT_WIKITEXT
333 );
334 $asserter->assertPageEnd();
335
336 // Page 5 (broken revision data)
337 $asserter->assertPageStart(
338 $this->pageId5,
339 $this->namespace,
340 $this->pageTitle5->getPrefixedText()
341 );
342 $asserter->assertRevision(
343 $this->revId5_1,
344 "BackupDumperTestP5 Summary1",
345 null,
346 24,
347 "d2vipufvkfs9wfruwjfj8eschxw0fbl",
348 false,
349 false,
350 CONTENT_MODEL_WIKITEXT,
351 CONTENT_FORMAT_WIKITEXT
352 );
353 $asserter->assertPageEnd();
354
355 $asserter->assertDumpEnd();
356
357 // FIXME: add multi-slot test case!
358 }
359
360 /**
361 * @dataProvider schemaVersionProvider
362 */
363 function testFullStubPlain( $schemaVersion ) {
364 // Preparing the dump
365 $fname = $this->getNewTempFile();
366
367 $dumper = $this->newDumpBackup(
368 [
369 '--full',
370 '--quiet',
371 '--output',
372 'file:' . $fname,
373 '--stub',
374 '--schema-version', $schemaVersion,
375 ],
376 $this->pageId1,
377 $this->pageId5 + 1
378 );
379
380 // Performing the dump. Suppress warnings, since we want to test
381 // accessing broken revision data (page 5).
382 $this->setMwGlobals( 'wgDevelopmentWarnings', false );
383 $dumper->execute();
384 $this->setMwGlobals( 'wgDevelopmentWarnings', true );
385
386 // Checking the dumped data
387 $this->assertDumpSchema( $fname, $this->getXmlSchemaPath( $schemaVersion ) );
388 $asserter = $this->getDumpAsserter( $schemaVersion );
389
390 $asserter->assertDumpStart( $fname );
391
392 // Page 1
393 $asserter->assertPageStart(
394 $this->pageId1,
395 $this->namespace,
396 $this->pageTitle1->getPrefixedText()
397 );
398 $asserter->assertRevision(
399 $this->revId1_1,
400 "BackupDumperTestP1Summary1",
401 $this->textId1_1,
402 23,
403 "0bolhl6ol7i6x0e7yq91gxgaan39j87"
404 );
405 $asserter->assertPageEnd();
406
407 // Page 2
408 $asserter->assertPageStart(
409 $this->pageId2,
410 $this->namespace,
411 $this->pageTitle2->getPrefixedText()
412 );
413 $asserter->assertRevision(
414 $this->revId2_1,
415 "BackupDumperTestP2Summary1",
416 $this->textId2_1,
417 23,
418 "jprywrymfhysqllua29tj3sc7z39dl2"
419 );
420 $asserter->assertRevision(
421 $this->revId2_2,
422 "BackupDumperTestP2Summary2",
423 null, // deleted!
424 false, // deleted!
425 null, // deleted!
426 false, // deleted!
427 $this->revId2_1
428 );
429 $asserter->assertRevision(
430 $this->revId2_3,
431 "BackupDumperTestP2Summary3",
432 $this->textId2_3,
433 23,
434 "jfunqmh1ssfb8rs43r19w98k28gg56r",
435 false,
436 $this->revId2_2
437 );
438 $asserter->assertRevision(
439 $this->revId2_4,
440 "BackupDumperTestP2Summary4 extra",
441 $this->textId2_4,
442 44,
443 "6o1ciaxa6pybnqprmungwofc4lv00wv",
444 false,
445 $this->revId2_3
446 );
447 $asserter->assertPageEnd();
448
449 // Page 3
450 // -> Page is marked deleted. Hence not visible
451
452 // Page 4
453 $asserter->assertPageStart(
454 $this->pageId4,
455 $this->talk_namespace,
456 $this->pageTitle4->getPrefixedText()
457 );
458 $asserter->assertRevision(
459 $this->revId4_1,
460 "Talk BackupDumperTestP1 Summary1",
461 $this->textId4_1,
462 35,
463 "nktofwzd0tl192k3zfepmlzxoax1lpe"
464 );
465 $asserter->assertPageEnd();
466
467 // Page 5 (broken revision data)
468 $asserter->assertPageStart(
469 $this->pageId5,
470 $this->namespace,
471 $this->pageTitle5->getPrefixedText()
472 );
473 $asserter->assertRevision(
474 $this->revId5_1,
475 "BackupDumperTestP5 Summary1",
476 null,
477 24,
478 "d2vipufvkfs9wfruwjfj8eschxw0fbl"
479 );
480 $asserter->assertPageEnd();
481
482 $asserter->assertDumpEnd();
483 }
484
485 /**
486 * @dataProvider schemaVersionProvider
487 */
488 function testCurrentStubPlain( $schemaVersion ) {
489 // Preparing the dump
490 $fname = $this->getNewTempFile();
491
492 $dumper = $this->newDumpBackup(
493 [ '--output', 'file:' . $fname, '--schema-version', $schemaVersion ],
494 $this->pageId1,
495 $this->pageId4 + 1
496 );
497
498 // Performing the dump
499 $dumper->dump( WikiExporter::CURRENT, WikiExporter::STUB );
500
501 // Checking the dumped data
502 $this->assertDumpSchema( $fname, $this->getXmlSchemaPath( $schemaVersion ) );
503
504 $asserter = $this->getDumpAsserter( $schemaVersion );
505 $asserter->assertDumpStart( $fname );
506
507 // Page 1
508 $asserter->assertPageStart(
509 $this->pageId1,
510 $this->namespace,
511 $this->pageTitle1->getPrefixedText()
512 );
513 $asserter->assertRevision(
514 $this->revId1_1,
515 "BackupDumperTestP1Summary1",
516 $this->textId1_1,
517 23,
518 "0bolhl6ol7i6x0e7yq91gxgaan39j87"
519 );
520 $asserter->assertPageEnd();
521
522 // Page 2
523 $asserter->assertPageStart(
524 $this->pageId2,
525 $this->namespace,
526 $this->pageTitle2->getPrefixedText()
527 );
528 $asserter->assertRevision(
529 $this->revId2_4,
530 "BackupDumperTestP2Summary4 extra",
531 $this->textId2_4,
532 44,
533 "6o1ciaxa6pybnqprmungwofc4lv00wv",
534 false,
535 $this->revId2_3
536 );
537 $asserter->assertPageEnd();
538
539 // Page 3
540 // -> Page is marked deleted. Hence not visible
541
542 // Page 4
543 $asserter->assertPageStart(
544 $this->pageId4,
545 $this->talk_namespace,
546 $this->pageTitle4->getPrefixedText()
547 );
548 $asserter->assertRevision(
549 $this->revId4_1,
550 "Talk BackupDumperTestP1 Summary1",
551 $this->textId4_1,
552 35,
553 "nktofwzd0tl192k3zfepmlzxoax1lpe"
554 );
555 $asserter->assertPageEnd();
556
557 $asserter->assertDumpEnd();
558 }
559
560 function testCurrentStubGzip() {
561 $this->checkHasGzip();
562
563 // Preparing the dump
564 $fname = $this->getNewTempFile();
565
566 $dumper = $this->newDumpBackup(
567 [ '--output', 'gzip:' . $fname ],
568 $this->pageId1,
569 $this->pageId4 + 1
570 );
571
572 // Performing the dump
573 $dumper->dump( WikiExporter::CURRENT, WikiExporter::STUB );
574
575 // Checking the dumped data
576 $this->gunzip( $fname );
577
578 $asserter = $this->getDumpAsserter();
579 $asserter->assertDumpStart( $fname );
580
581 // Page 1
582 $asserter->assertPageStart(
583 $this->pageId1,
584 $this->namespace,
585 $this->pageTitle1->getPrefixedText()
586 );
587 $asserter->assertRevision(
588 $this->revId1_1,
589 "BackupDumperTestP1Summary1",
590 $this->textId1_1,
591 23,
592 "0bolhl6ol7i6x0e7yq91gxgaan39j87"
593 );
594 $asserter->assertPageEnd();
595
596 // Page 2
597 $asserter->assertPageStart(
598 $this->pageId2,
599 $this->namespace,
600 $this->pageTitle2->getPrefixedText()
601 );
602 $asserter->assertRevision(
603 $this->revId2_4,
604 "BackupDumperTestP2Summary4 extra",
605 $this->textId2_4,
606 44,
607 "6o1ciaxa6pybnqprmungwofc4lv00wv",
608 false,
609 $this->revId2_3
610 );
611 $asserter->assertPageEnd();
612
613 // Page 3
614 // -> Page is marked deleted. Hence not visible
615
616 // Page 4
617 $asserter->assertPageStart(
618 $this->pageId4,
619 $this->talk_namespace,
620 $this->pageTitle4->getPrefixedText()
621 );
622 $asserter->assertRevision( $this->revId4_1, "Talk BackupDumperTestP1 Summary1",
623 $this->textId4_1, 35, "nktofwzd0tl192k3zfepmlzxoax1lpe" );
624 $asserter->assertPageEnd();
625
626 $asserter->assertDumpEnd();
627 }
628
629 /**
630 * xmldumps-backup typically performs a single dump that that writes
631 * out three files
632 * - gzipped stubs of everything (meta-history)
633 * - gzipped stubs of latest revisions of all pages (meta-current)
634 * - gzipped stubs of latest revisions of all pages of namespage 0
635 * (articles)
636 *
637 * We reproduce such a setup with our mini fixture, although we omit
638 * chunks, and all the other gimmicks of xmldumps-backup.
639 *
640 * @dataProvider schemaVersionProvider
641 */
642 function testXmlDumpsBackupUseCase( $schemaVersion ) {
643 $this->checkHasGzip();
644
645 $fnameMetaHistory = $this->getNewTempFile();
646 $fnameMetaCurrent = $this->getNewTempFile();
647 $fnameArticles = $this->getNewTempFile();
648
649 $dumper = $this->newDumpBackup(
650 [ "--full", "--stub", "--output=gzip:" . $fnameMetaHistory,
651 "--output=gzip:" . $fnameMetaCurrent, "--filter=latest",
652 "--output=gzip:" . $fnameArticles, "--filter=latest",
653 "--filter=notalk", "--filter=namespace:!NS_USER",
654 "--reporting=1000", '--schema-version', $schemaVersion
655 ],
656 $this->pageId1,
657 $this->pageId4 + 1
658 );
659 $dumper->reporting = true;
660
661 // xmldumps-backup uses reporting. We will not check the exact reported
662 // message, as they are dependent on the processing power of the used
663 // computer. We only check that reporting does not crash the dumping
664 // and that something is reported
665 $dumper->stderr = fopen( 'php://output', 'a' );
666 if ( $dumper->stderr === false ) {
667 $this->fail( "Could not open stream for stderr" );
668 }
669
670 // Performing the dump
671 $dumper->dump( WikiExporter::FULL, WikiExporter::STUB );
672
673 $this->assertTrue( fclose( $dumper->stderr ), "Closing stderr handle" );
674
675 // Checking meta-history -------------------------------------------------
676
677 $this->gunzip( $fnameMetaHistory );
678 $this->assertDumpSchema( $fnameMetaHistory, $this->getXmlSchemaPath( $schemaVersion ) );
679
680 $asserter = $this->getDumpAsserter( $schemaVersion );
681 $asserter->assertDumpStart( $fnameMetaHistory );
682
683 // Page 1
684 $asserter->assertPageStart(
685 $this->pageId1,
686 $this->namespace,
687 $this->pageTitle1->getPrefixedText()
688 );
689 $asserter->assertRevision(
690 $this->revId1_1,
691 "BackupDumperTestP1Summary1",
692 $this->textId1_1,
693 23,
694 "0bolhl6ol7i6x0e7yq91gxgaan39j87"
695 );
696 $asserter->assertPageEnd();
697
698 // Page 2
699 $asserter->assertPageStart(
700 $this->pageId2,
701 $this->namespace,
702 $this->pageTitle2->getPrefixedText()
703 );
704 $asserter->assertRevision(
705 $this->revId2_1,
706 "BackupDumperTestP2Summary1",
707 $this->textId2_1,
708 23,
709 "jprywrymfhysqllua29tj3sc7z39dl2"
710 );
711 $asserter->assertRevision(
712 $this->revId2_2,
713 "BackupDumperTestP2Summary2",
714 null, // deleted!
715 false, // deleted!
716 null, // deleted!
717 false, // deleted!
718 $this->revId2_1
719 );
720 $asserter->assertRevision(
721 $this->revId2_3,
722 "BackupDumperTestP2Summary3",
723 $this->textId2_3,
724 23,
725 "jfunqmh1ssfb8rs43r19w98k28gg56r",
726 false,
727 $this->revId2_2
728 );
729 $asserter->assertRevision(
730 $this->revId2_4,
731 "BackupDumperTestP2Summary4 extra",
732 $this->textId2_4,
733 44,
734 "6o1ciaxa6pybnqprmungwofc4lv00wv",
735 false,
736 $this->revId2_3
737 );
738 $asserter->assertPageEnd();
739
740 // Page 3
741 // -> Page is marked deleted. Hence not visible
742
743 // Page 4
744 $asserter->assertPageStart(
745 $this->pageId4,
746 $this->talk_namespace,
747 $this->pageTitle4->getPrefixedText( $schemaVersion )
748 );
749 $asserter->assertRevision(
750 $this->revId4_1,
751 "Talk BackupDumperTestP1 Summary1",
752 $this->textId4_1,
753 35,
754 "nktofwzd0tl192k3zfepmlzxoax1lpe"
755 );
756 $asserter->assertPageEnd();
757
758 $asserter->assertDumpEnd();
759
760 // Checking meta-current -------------------------------------------------
761
762 $this->gunzip( $fnameMetaCurrent );
763 $this->assertDumpSchema( $fnameMetaCurrent, $this->getXmlSchemaPath( $schemaVersion ) );
764
765 $asserter = $this->getDumpAsserter( $schemaVersion );
766 $asserter->assertDumpStart( $fnameMetaCurrent );
767
768 // Page 1
769 $asserter->assertPageStart(
770 $this->pageId1,
771 $this->namespace,
772 $this->pageTitle1->getPrefixedText()
773 );
774 $asserter->assertRevision(
775 $this->revId1_1,
776 "BackupDumperTestP1Summary1",
777 $this->textId1_1,
778 23,
779 "0bolhl6ol7i6x0e7yq91gxgaan39j87"
780 );
781 $asserter->assertPageEnd();
782
783 // Page 2
784 $asserter->assertPageStart(
785 $this->pageId2,
786 $this->namespace,
787 $this->pageTitle2->getPrefixedText()
788 );
789 $asserter->assertRevision(
790 $this->revId2_4,
791 "BackupDumperTestP2Summary4 extra",
792 $this->textId2_4,
793 44,
794 "6o1ciaxa6pybnqprmungwofc4lv00wv",
795 false,
796 $this->revId2_3
797 );
798 $asserter->assertPageEnd();
799
800 // Page 3
801 // -> Page is marked deleted. Hence not visible
802
803 // Page 4
804 $asserter->assertPageStart(
805 $this->pageId4,
806 $this->talk_namespace,
807 $this->pageTitle4->getPrefixedText()
808 );
809 $asserter->assertRevision(
810 $this->revId4_1,
811 "Talk BackupDumperTestP1 Summary1",
812 $this->textId4_1,
813 35,
814 "nktofwzd0tl192k3zfepmlzxoax1lpe"
815 );
816 $asserter->assertPageEnd();
817
818 $asserter->assertDumpEnd();
819
820 // Checking articles -------------------------------------------------
821
822 $this->gunzip( $fnameArticles );
823 $this->assertDumpSchema( $fnameArticles, $this->getXmlSchemaPath( $schemaVersion ) );
824
825 $asserter = $this->getDumpAsserter( $schemaVersion );
826 $asserter->assertDumpStart( $fnameArticles );
827
828 // Page 1
829 $asserter->assertPageStart(
830 $this->pageId1,
831 $this->namespace,
832 $this->pageTitle1->getPrefixedText()
833 );
834 $asserter->assertRevision(
835 $this->revId1_1,
836 "BackupDumperTestP1Summary1",
837 $this->textId1_1,
838 23,
839 "0bolhl6ol7i6x0e7yq91gxgaan39j87"
840 );
841 $asserter->assertPageEnd();
842
843 // Page 2
844 $asserter->assertPageStart(
845 $this->pageId2,
846 $this->namespace,
847 $this->pageTitle2->getPrefixedText()
848 );
849 $asserter->assertRevision(
850 $this->revId2_4,
851 "BackupDumperTestP2Summary4 extra",
852 $this->textId2_4,
853 44,
854 "6o1ciaxa6pybnqprmungwofc4lv00wv",
855 false,
856 $this->revId2_3
857 );
858 $asserter->assertPageEnd();
859
860 // Page 3
861 // -> Page is marked deleted. Hence not visible
862
863 // Page 4
864 // -> Page is not in $this->namespace. Hence not visible
865
866 $asserter->assertDumpEnd();
867
868 $this->expectETAOutput();
869 }
870 }