46 $this->tablesUsed[] =
'page';
47 $this->tablesUsed[] =
'revision';
48 $this->tablesUsed[] =
'ip_changes';
49 $this->tablesUsed[] =
'text';
53 $this->talk_namespace =
NS_TALK;
55 if ( $this->
namespace === $this->talk_namespace ) {
57 throw new MWException(
"The default wikitext namespace is the talk namespace. "
58 .
" We can't currently deal with that." );
61 $this->pageTitle1 = Title::newFromText(
'BackupDumperTestP1', $this->
namespace );
62 $page = WikiPage::factory( $this->pageTitle1 );
64 "BackupDumperTestP1Text1",
"BackupDumperTestP1Summary1" );
65 $this->pageId1 = $page->getId();
67 $this->pageTitle2 = Title::newFromText(
'BackupDumperTestP2', $this->
namespace );
68 $page = WikiPage::factory( $this->pageTitle2 );
70 "BackupDumperTestP2Text1",
"BackupDumperTestP2Summary1" );
72 "BackupDumperTestP2Text2",
"BackupDumperTestP2Summary2" );
74 "BackupDumperTestP2Text3",
"BackupDumperTestP2Summary3" );
76 "BackupDumperTestP2Text4 some additional Text ",
77 "BackupDumperTestP2Summary4 extra " );
78 $this->pageId2 = $page->getId();
80 $this->pageTitle3 = Title::newFromText(
'BackupDumperTestP3', $this->
namespace );
81 $page = WikiPage::factory( $this->pageTitle3 );
83 "BackupDumperTestP3Text1",
"BackupDumperTestP2Summary1" );
85 "BackupDumperTestP3Text2",
"BackupDumperTestP2Summary2" );
86 $this->pageId3 = $page->getId();
87 $page->doDeleteArticle(
"Testing ;)" );
89 $this->pageTitle4 = Title::newFromText(
'BackupDumperTestP1', $this->talk_namespace );
90 $page = WikiPage::factory( $this->pageTitle4 );
92 "Talk about BackupDumperTestP1 Text1",
93 "Talk BackupDumperTestP1 Summary1" );
94 $this->pageId4 = $page->getId();
95 }
catch ( Exception
$e ) {
99 $this->exceptionFromAddDBData =
$e;
188 [
'--full',
'--quiet',
'--output',
'file:' .
$fname,
'--schema-version', $schemaVersion ],
200 $asserter->assertDumpStart(
$fname );
203 $asserter->assertPageStart(
206 $this->pageTitle1->getPrefixedText()
208 $asserter->assertRevision(
210 "BackupDumperTestP1Summary1",
213 "0bolhl6ol7i6x0e7yq91gxgaan39j87",
214 "BackupDumperTestP1Text1"
216 $asserter->assertPageEnd();
219 $asserter->assertPageStart(
222 $this->pageTitle2->getPrefixedText()
224 $asserter->assertRevision(
226 "BackupDumperTestP2Summary1",
229 "jprywrymfhysqllua29tj3sc7z39dl2",
230 "BackupDumperTestP2Text1"
232 $asserter->assertRevision(
234 "BackupDumperTestP2Summary2",
237 "b7vj5ks32po5m1z1t1br4o7scdwwy95",
238 "BackupDumperTestP2Text2",
241 $asserter->assertRevision(
243 "BackupDumperTestP2Summary3",
246 "jfunqmh1ssfb8rs43r19w98k28gg56r",
247 "BackupDumperTestP2Text3",
250 $asserter->assertRevision(
252 "BackupDumperTestP2Summary4 extra",
255 "6o1ciaxa6pybnqprmungwofc4lv00wv",
256 "BackupDumperTestP2Text4 some additional Text",
259 $asserter->assertPageEnd();
265 $asserter->assertPageStart(
267 $this->talk_namespace,
268 $this->pageTitle4->getPrefixedText()
270 $asserter->assertRevision(
272 "Talk BackupDumperTestP1 Summary1",
275 "nktofwzd0tl192k3zfepmlzxoax1lpe",
276 "Talk about BackupDumperTestP1 Text1",
282 $asserter->assertPageEnd();
284 $asserter->assertDumpEnd();
303 '--schema-version', $schemaVersion,
316 $asserter->assertDumpStart(
$fname );
319 $asserter->assertPageStart(
322 $this->pageTitle1->getPrefixedText()
324 $asserter->assertRevision(
326 "BackupDumperTestP1Summary1",
329 "0bolhl6ol7i6x0e7yq91gxgaan39j87"
331 $asserter->assertPageEnd();
334 $asserter->assertPageStart(
337 $this->pageTitle2->getPrefixedText()
339 $asserter->assertRevision(
341 "BackupDumperTestP2Summary1",
344 "jprywrymfhysqllua29tj3sc7z39dl2"
346 $asserter->assertRevision(
348 "BackupDumperTestP2Summary2",
351 "b7vj5ks32po5m1z1t1br4o7scdwwy95",
355 $asserter->assertRevision(
357 "BackupDumperTestP2Summary3",
360 "jfunqmh1ssfb8rs43r19w98k28gg56r",
364 $asserter->assertRevision(
366 "BackupDumperTestP2Summary4 extra",
369 "6o1ciaxa6pybnqprmungwofc4lv00wv",
373 $asserter->assertPageEnd();
379 $asserter->assertPageStart(
381 $this->talk_namespace,
382 $this->pageTitle4->getPrefixedText()
384 $asserter->assertRevision(
386 "Talk BackupDumperTestP1 Summary1",
389 "nktofwzd0tl192k3zfepmlzxoax1lpe"
391 $asserter->assertPageEnd();
393 $asserter->assertDumpEnd();
404 [
'--output',
'file:' .
$fname,
'--schema-version', $schemaVersion ],
410 $dumper->dump( WikiExporter::CURRENT, WikiExporter::STUB );
416 $asserter->assertDumpStart(
$fname );
419 $asserter->assertPageStart(
422 $this->pageTitle1->getPrefixedText()
424 $asserter->assertRevision(
426 "BackupDumperTestP1Summary1",
429 "0bolhl6ol7i6x0e7yq91gxgaan39j87"
431 $asserter->assertPageEnd();
434 $asserter->assertPageStart(
437 $this->pageTitle2->getPrefixedText()
439 $asserter->assertRevision(
441 "BackupDumperTestP2Summary4 extra",
444 "6o1ciaxa6pybnqprmungwofc4lv00wv",
448 $asserter->assertPageEnd();
454 $asserter->assertPageStart(
456 $this->talk_namespace,
457 $this->pageTitle4->getPrefixedText()
459 $asserter->assertRevision(
461 "Talk BackupDumperTestP1 Summary1",
464 "nktofwzd0tl192k3zfepmlzxoax1lpe"
466 $asserter->assertPageEnd();
468 $asserter->assertDumpEnd();
478 [
'--output',
'gzip:' .
$fname ],
484 $dumper->dump( WikiExporter::CURRENT, WikiExporter::STUB );
490 $asserter->assertDumpStart(
$fname );
493 $asserter->assertPageStart(
496 $this->pageTitle1->getPrefixedText()
498 $asserter->assertRevision(
500 "BackupDumperTestP1Summary1",
503 "0bolhl6ol7i6x0e7yq91gxgaan39j87"
505 $asserter->assertPageEnd();
508 $asserter->assertPageStart(
511 $this->pageTitle2->getPrefixedText()
513 $asserter->assertRevision(
515 "BackupDumperTestP2Summary4 extra",
518 "6o1ciaxa6pybnqprmungwofc4lv00wv",
522 $asserter->assertPageEnd();
528 $asserter->assertPageStart(
530 $this->talk_namespace,
531 $this->pageTitle4->getPrefixedText()
533 $asserter->assertRevision( $this->revId4_1,
"Talk BackupDumperTestP1 Summary1",
534 $this->textId4_1, 35,
"nktofwzd0tl192k3zfepmlzxoax1lpe" );
535 $asserter->assertPageEnd();
537 $asserter->assertDumpEnd();
561 [
"--full",
"--stub",
"--output=gzip:" . $fnameMetaHistory,
562 "--output=gzip:" . $fnameMetaCurrent,
"--filter=latest",
563 "--output=gzip:" . $fnameArticles,
"--filter=latest",
564 "--filter=notalk",
"--filter=namespace:!NS_USER",
565 "--reporting=1000",
'--schema-version', $schemaVersion
570 $dumper->reporting =
true;
576 $dumper->stderr = fopen(
'php://output',
'a' );
577 if ( $dumper->stderr ===
false ) {
578 $this->fail(
"Could not open stream for stderr" );
582 $dumper->dump( WikiExporter::FULL, WikiExporter::STUB );
584 $this->assertTrue( fclose( $dumper->stderr ),
"Closing stderr handle" );
588 $this->
gunzip( $fnameMetaHistory );
592 $asserter->assertDumpStart( $fnameMetaHistory );
595 $asserter->assertPageStart(
598 $this->pageTitle1->getPrefixedText()
600 $asserter->assertRevision(
602 "BackupDumperTestP1Summary1",
605 "0bolhl6ol7i6x0e7yq91gxgaan39j87"
607 $asserter->assertPageEnd();
610 $asserter->assertPageStart(
613 $this->pageTitle2->getPrefixedText()
615 $asserter->assertRevision(
617 "BackupDumperTestP2Summary1",
620 "jprywrymfhysqllua29tj3sc7z39dl2"
622 $asserter->assertRevision(
624 "BackupDumperTestP2Summary2",
627 "b7vj5ks32po5m1z1t1br4o7scdwwy95",
631 $asserter->assertRevision(
633 "BackupDumperTestP2Summary3",
636 "jfunqmh1ssfb8rs43r19w98k28gg56r",
640 $asserter->assertRevision(
642 "BackupDumperTestP2Summary4 extra",
645 "6o1ciaxa6pybnqprmungwofc4lv00wv",
649 $asserter->assertPageEnd();
655 $asserter->assertPageStart(
657 $this->talk_namespace,
658 $this->pageTitle4->getPrefixedText( $schemaVersion )
660 $asserter->assertRevision(
662 "Talk BackupDumperTestP1 Summary1",
665 "nktofwzd0tl192k3zfepmlzxoax1lpe"
667 $asserter->assertPageEnd();
669 $asserter->assertDumpEnd();
673 $this->
gunzip( $fnameMetaCurrent );
677 $asserter->assertDumpStart( $fnameMetaCurrent );
680 $asserter->assertPageStart(
683 $this->pageTitle1->getPrefixedText()
685 $asserter->assertRevision(
687 "BackupDumperTestP1Summary1",
690 "0bolhl6ol7i6x0e7yq91gxgaan39j87"
692 $asserter->assertPageEnd();
695 $asserter->assertPageStart(
698 $this->pageTitle2->getPrefixedText()
700 $asserter->assertRevision(
702 "BackupDumperTestP2Summary4 extra",
705 "6o1ciaxa6pybnqprmungwofc4lv00wv",
709 $asserter->assertPageEnd();
715 $asserter->assertPageStart(
717 $this->talk_namespace,
718 $this->pageTitle4->getPrefixedText()
720 $asserter->assertRevision(
722 "Talk BackupDumperTestP1 Summary1",
725 "nktofwzd0tl192k3zfepmlzxoax1lpe"
727 $asserter->assertPageEnd();
729 $asserter->assertDumpEnd();
733 $this->
gunzip( $fnameArticles );
737 $asserter->assertDumpStart( $fnameArticles );
740 $asserter->assertPageStart(
743 $this->pageTitle1->getPrefixedText()
745 $asserter->assertRevision(
747 "BackupDumperTestP1Summary1",
750 "0bolhl6ol7i6x0e7yq91gxgaan39j87"
752 $asserter->assertPageEnd();
755 $asserter->assertPageStart(
758 $this->pageTitle2->getPrefixedText()
760 $asserter->assertRevision(
762 "BackupDumperTestP2Summary4 extra",
765 "6o1ciaxa6pybnqprmungwofc4lv00wv",
769 $asserter->assertPageEnd();
777 $asserter->assertDumpEnd();