MediaWiki REL1_33
backup_PageTest.php
Go to the documentation of this file.
1<?php
2
4
6use Exception;
16
25
26 // We'll add several pages, revision and texts. The following variables hold the
27 // corresponding ids.
36
40 private $streamingLoadBalancer = null;
41
42 function addDBData() {
43 // be sure, titles created here using english namespace names
44 $this->setContentLang( 'en' );
45
46 $this->tablesUsed[] = 'page';
47 $this->tablesUsed[] = 'revision';
48 $this->tablesUsed[] = 'ip_changes';
49 $this->tablesUsed[] = 'text';
50
51 try {
52 $this->namespace = $this->getDefaultWikitextNS();
53 $this->talk_namespace = NS_TALK;
54
55 if ( $this->namespace === $this->talk_namespace ) {
56 // @todo work around this.
57 throw new MWException( "The default wikitext namespace is the talk namespace. "
58 . " We can't currently deal with that." );
59 }
60
61 $this->pageTitle1 = Title::newFromText( 'BackupDumperTestP1', $this->namespace );
62 $page = WikiPage::factory( $this->pageTitle1 );
63 list( $this->revId1_1, $this->textId1_1 ) = $this->addRevision( $page,
64 "BackupDumperTestP1Text1", "BackupDumperTestP1Summary1" );
65 $this->pageId1 = $page->getId();
66
67 $this->pageTitle2 = Title::newFromText( 'BackupDumperTestP2', $this->namespace );
68 $page = WikiPage::factory( $this->pageTitle2 );
69 list( $this->revId2_1, $this->textId2_1 ) = $this->addRevision( $page,
70 "BackupDumperTestP2Text1", "BackupDumperTestP2Summary1" );
71 list( $this->revId2_2, $this->textId2_2 ) = $this->addRevision( $page,
72 "BackupDumperTestP2Text2", "BackupDumperTestP2Summary2" );
73 list( $this->revId2_3, $this->textId2_3 ) = $this->addRevision( $page,
74 "BackupDumperTestP2Text3", "BackupDumperTestP2Summary3" );
75 list( $this->revId2_4, $this->textId2_4 ) = $this->addRevision( $page,
76 "BackupDumperTestP2Text4 some additional Text ",
77 "BackupDumperTestP2Summary4 extra " );
78 $this->pageId2 = $page->getId();
79
80 $this->pageTitle3 = Title::newFromText( 'BackupDumperTestP3', $this->namespace );
81 $page = WikiPage::factory( $this->pageTitle3 );
82 list( $this->revId3_1, $this->textId3_1 ) = $this->addRevision( $page,
83 "BackupDumperTestP3Text1", "BackupDumperTestP2Summary1" );
84 list( $this->revId3_2, $this->textId3_2 ) = $this->addRevision( $page,
85 "BackupDumperTestP3Text2", "BackupDumperTestP2Summary2" );
86 $this->pageId3 = $page->getId();
87 $page->doDeleteArticle( "Testing ;)" );
88
89 $this->pageTitle4 = Title::newFromText( 'BackupDumperTestP1', $this->talk_namespace );
90 $page = WikiPage::factory( $this->pageTitle4 );
91 list( $this->revId4_1, $this->textId4_1 ) = $this->addRevision( $page,
92 "Talk about BackupDumperTestP1 Text1",
93 "Talk BackupDumperTestP1 Summary1" );
94 $this->pageId4 = $page->getId();
95 } catch ( Exception $e ) {
96 // We'd love to pass $e directly. However, ... see
97 // documentation of exceptionFromAddDBData in
98 // DumpTestCase
99 $this->exceptionFromAddDBData = $e;
100 }
101 }
102
103 protected function setUp() {
104 parent::setUp();
105
106 // Since we will restrict dumping by page ranges (to allow
107 // working tests, even if the db gets prepopulated by a base
108 // class), we have to assert, that the page id are consecutively
109 // increasing
110 $this->assertEquals(
111 [ $this->pageId2, $this->pageId3, $this->pageId4 ],
112 [ $this->pageId1 + 1, $this->pageId2 + 1, $this->pageId3 + 1 ],
113 "Page ids increasing without holes" );
114 }
115
116 function tearDown() {
117 parent::tearDown();
118
119 if ( isset( $this->streamingLoadBalancer ) ) {
120 $this->streamingLoadBalancer->closeAll();
121 }
122 }
123
130 private function newStreamingDBConnection() {
131 // Create a *new* LoadBalancer, so no connections are shared
132 if ( !$this->streamingLoadBalancer ) {
133 $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
134
135 $this->streamingLoadBalancer = $lbFactory->newMainLB();
136 }
137
138 $db = $this->streamingLoadBalancer->getConnection( DB_REPLICA );
139
140 // Make sure the DB connection has the fake table clones and the fake table prefix
142
143 // Make sure the DB connection has all the test data
144 $this->copyTestData( $this->db, $db );
145
146 return $db;
147 }
148
156 private function newDumpBackup( $argv, $startId, $endId ) {
157 $dumper = new DumpBackup( $argv );
158 $dumper->startId = $startId;
159 $dumper->endId = $endId;
160 $dumper->reporting = false;
161
162 // NOTE: The copyTestData() method used by newStreamingDBConnection()
163 // doesn't work with SQLite (T217607).
164 // But DatabaseSqlite doesn't support streaming anyway, so just skip that part.
165 if ( $this->db->getType() === 'sqlite' ) {
166 $dumper->setDB( $this->db );
167 } else {
168 $dumper->setDB( $this->newStreamingDBConnection() );
169 }
170
171 return $dumper;
172 }
173
174 public function schemaVersionProvider() {
175 foreach ( XmlDumpWriter::$supportedSchemas as $schemaVersion ) {
176 yield [ $schemaVersion ];
177 }
178 }
179
183 function testFullTextPlain( $schemaVersion ) {
184 // Preparing the dump
185 $fname = $this->getNewTempFile();
186
187 $dumper = $this->newDumpBackup(
188 [ '--full', '--quiet', '--output', 'file:' . $fname, '--schema-version', $schemaVersion ],
189 $this->pageId1,
190 $this->pageId4 + 1
191 );
192
193 // Performing the dump
194 $dumper->execute();
195
196 // Checking the dumped data
197 $this->assertDumpSchema( $fname, $this->getXmlSchemaPath( $schemaVersion ) );
198 $asserter = $this->getDumpAsserter( $schemaVersion );
199
200 $asserter->assertDumpStart( $fname );
201
202 // Page 1
203 $asserter->assertPageStart(
204 $this->pageId1,
205 $this->namespace,
206 $this->pageTitle1->getPrefixedText()
207 );
208 $asserter->assertRevision(
209 $this->revId1_1,
210 "BackupDumperTestP1Summary1",
211 $this->textId1_1,
212 23,
213 "0bolhl6ol7i6x0e7yq91gxgaan39j87",
214 "BackupDumperTestP1Text1"
215 );
216 $asserter->assertPageEnd();
217
218 // Page 2
219 $asserter->assertPageStart(
220 $this->pageId2,
221 $this->namespace,
222 $this->pageTitle2->getPrefixedText()
223 );
224 $asserter->assertRevision(
225 $this->revId2_1,
226 "BackupDumperTestP2Summary1",
227 $this->textId2_1,
228 23,
229 "jprywrymfhysqllua29tj3sc7z39dl2",
230 "BackupDumperTestP2Text1"
231 );
232 $asserter->assertRevision(
233 $this->revId2_2,
234 "BackupDumperTestP2Summary2",
235 $this->textId2_2,
236 23,
237 "b7vj5ks32po5m1z1t1br4o7scdwwy95",
238 "BackupDumperTestP2Text2",
239 $this->revId2_1
240 );
241 $asserter->assertRevision(
242 $this->revId2_3,
243 "BackupDumperTestP2Summary3",
244 $this->textId2_3,
245 23,
246 "jfunqmh1ssfb8rs43r19w98k28gg56r",
247 "BackupDumperTestP2Text3",
248 $this->revId2_2
249 );
250 $asserter->assertRevision(
251 $this->revId2_4,
252 "BackupDumperTestP2Summary4 extra",
253 $this->textId2_4,
254 44,
255 "6o1ciaxa6pybnqprmungwofc4lv00wv",
256 "BackupDumperTestP2Text4 some additional Text",
257 $this->revId2_3
258 );
259 $asserter->assertPageEnd();
260
261 // Page 3
262 // -> Page is marked deleted. Hence not visible
263
264 // Page 4
265 $asserter->assertPageStart(
266 $this->pageId4,
267 $this->talk_namespace,
268 $this->pageTitle4->getPrefixedText()
269 );
270 $asserter->assertRevision(
271 $this->revId4_1,
272 "Talk BackupDumperTestP1 Summary1",
273 $this->textId4_1,
274 35,
275 "nktofwzd0tl192k3zfepmlzxoax1lpe",
276 "Talk about BackupDumperTestP1 Text1",
277 false,
280 $schemaVersion
281 );
282 $asserter->assertPageEnd();
283
284 $asserter->assertDumpEnd();
285
286 // FIXME: add multi-slot test case!
287 }
288
292 function testFullStubPlain( $schemaVersion ) {
293 // Preparing the dump
294 $fname = $this->getNewTempFile();
295
296 $dumper = $this->newDumpBackup(
297 [
298 '--full',
299 '--quiet',
300 '--output',
301 'file:' . $fname,
302 '--stub',
303 '--schema-version', $schemaVersion,
304 ],
305 $this->pageId1,
306 $this->pageId4 + 1
307 );
308
309 // Performing the dump
310 $dumper->execute();
311
312 // Checking the dumped data
313 $this->assertDumpSchema( $fname, $this->getXmlSchemaPath( $schemaVersion ) );
314 $asserter = $this->getDumpAsserter( $schemaVersion );
315
316 $asserter->assertDumpStart( $fname );
317
318 // Page 1
319 $asserter->assertPageStart(
320 $this->pageId1,
321 $this->namespace,
322 $this->pageTitle1->getPrefixedText()
323 );
324 $asserter->assertRevision(
325 $this->revId1_1,
326 "BackupDumperTestP1Summary1",
327 $this->textId1_1,
328 23,
329 "0bolhl6ol7i6x0e7yq91gxgaan39j87"
330 );
331 $asserter->assertPageEnd();
332
333 // Page 2
334 $asserter->assertPageStart(
335 $this->pageId2,
336 $this->namespace,
337 $this->pageTitle2->getPrefixedText()
338 );
339 $asserter->assertRevision(
340 $this->revId2_1,
341 "BackupDumperTestP2Summary1",
342 $this->textId2_1,
343 23,
344 "jprywrymfhysqllua29tj3sc7z39dl2"
345 );
346 $asserter->assertRevision(
347 $this->revId2_2,
348 "BackupDumperTestP2Summary2",
349 $this->textId2_2,
350 23,
351 "b7vj5ks32po5m1z1t1br4o7scdwwy95",
352 false,
353 $this->revId2_1
354 );
355 $asserter->assertRevision(
356 $this->revId2_3,
357 "BackupDumperTestP2Summary3",
358 $this->textId2_3,
359 23,
360 "jfunqmh1ssfb8rs43r19w98k28gg56r",
361 false,
362 $this->revId2_2
363 );
364 $asserter->assertRevision(
365 $this->revId2_4,
366 "BackupDumperTestP2Summary4 extra",
367 $this->textId2_4,
368 44,
369 "6o1ciaxa6pybnqprmungwofc4lv00wv",
370 false,
371 $this->revId2_3
372 );
373 $asserter->assertPageEnd();
374
375 // Page 3
376 // -> Page is marked deleted. Hence not visible
377
378 // Page 4
379 $asserter->assertPageStart(
380 $this->pageId4,
381 $this->talk_namespace,
382 $this->pageTitle4->getPrefixedText()
383 );
384 $asserter->assertRevision(
385 $this->revId4_1,
386 "Talk BackupDumperTestP1 Summary1",
387 $this->textId4_1,
388 35,
389 "nktofwzd0tl192k3zfepmlzxoax1lpe"
390 );
391 $asserter->assertPageEnd();
392
393 $asserter->assertDumpEnd();
394 }
395
399 function testCurrentStubPlain( $schemaVersion ) {
400 // Preparing the dump
401 $fname = $this->getNewTempFile();
402
403 $dumper = $this->newDumpBackup(
404 [ '--output', 'file:' . $fname, '--schema-version', $schemaVersion ],
405 $this->pageId1,
406 $this->pageId4 + 1
407 );
408
409 // Performing the dump
410 $dumper->dump( WikiExporter::CURRENT, WikiExporter::STUB );
411
412 // Checking the dumped data
413 $this->assertDumpSchema( $fname, $this->getXmlSchemaPath( $schemaVersion ) );
414
415 $asserter = $this->getDumpAsserter( $schemaVersion );
416 $asserter->assertDumpStart( $fname );
417
418 // Page 1
419 $asserter->assertPageStart(
420 $this->pageId1,
421 $this->namespace,
422 $this->pageTitle1->getPrefixedText()
423 );
424 $asserter->assertRevision(
425 $this->revId1_1,
426 "BackupDumperTestP1Summary1",
427 $this->textId1_1,
428 23,
429 "0bolhl6ol7i6x0e7yq91gxgaan39j87"
430 );
431 $asserter->assertPageEnd();
432
433 // Page 2
434 $asserter->assertPageStart(
435 $this->pageId2,
436 $this->namespace,
437 $this->pageTitle2->getPrefixedText()
438 );
439 $asserter->assertRevision(
440 $this->revId2_4,
441 "BackupDumperTestP2Summary4 extra",
442 $this->textId2_4,
443 44,
444 "6o1ciaxa6pybnqprmungwofc4lv00wv",
445 false,
446 $this->revId2_3
447 );
448 $asserter->assertPageEnd();
449
450 // Page 3
451 // -> Page is marked deleted. Hence not visible
452
453 // Page 4
454 $asserter->assertPageStart(
455 $this->pageId4,
456 $this->talk_namespace,
457 $this->pageTitle4->getPrefixedText()
458 );
459 $asserter->assertRevision(
460 $this->revId4_1,
461 "Talk BackupDumperTestP1 Summary1",
462 $this->textId4_1,
463 35,
464 "nktofwzd0tl192k3zfepmlzxoax1lpe"
465 );
466 $asserter->assertPageEnd();
467
468 $asserter->assertDumpEnd();
469 }
470
472 $this->checkHasGzip();
473
474 // Preparing the dump
475 $fname = $this->getNewTempFile();
476
477 $dumper = $this->newDumpBackup(
478 [ '--output', 'gzip:' . $fname ],
479 $this->pageId1,
480 $this->pageId4 + 1
481 );
482
483 // Performing the dump
484 $dumper->dump( WikiExporter::CURRENT, WikiExporter::STUB );
485
486 // Checking the dumped data
487 $this->gunzip( $fname );
488
489 $asserter = $this->getDumpAsserter();
490 $asserter->assertDumpStart( $fname );
491
492 // Page 1
493 $asserter->assertPageStart(
494 $this->pageId1,
495 $this->namespace,
496 $this->pageTitle1->getPrefixedText()
497 );
498 $asserter->assertRevision(
499 $this->revId1_1,
500 "BackupDumperTestP1Summary1",
501 $this->textId1_1,
502 23,
503 "0bolhl6ol7i6x0e7yq91gxgaan39j87"
504 );
505 $asserter->assertPageEnd();
506
507 // Page 2
508 $asserter->assertPageStart(
509 $this->pageId2,
510 $this->namespace,
511 $this->pageTitle2->getPrefixedText()
512 );
513 $asserter->assertRevision(
514 $this->revId2_4,
515 "BackupDumperTestP2Summary4 extra",
516 $this->textId2_4,
517 44,
518 "6o1ciaxa6pybnqprmungwofc4lv00wv",
519 false,
520 $this->revId2_3
521 );
522 $asserter->assertPageEnd();
523
524 // Page 3
525 // -> Page is marked deleted. Hence not visible
526
527 // Page 4
528 $asserter->assertPageStart(
529 $this->pageId4,
530 $this->talk_namespace,
531 $this->pageTitle4->getPrefixedText()
532 );
533 $asserter->assertRevision( $this->revId4_1, "Talk BackupDumperTestP1 Summary1",
534 $this->textId4_1, 35, "nktofwzd0tl192k3zfepmlzxoax1lpe" );
535 $asserter->assertPageEnd();
536
537 $asserter->assertDumpEnd();
538 }
539
553 function testXmlDumpsBackupUseCase( $schemaVersion ) {
554 $this->checkHasGzip();
555
556 $fnameMetaHistory = $this->getNewTempFile();
557 $fnameMetaCurrent = $this->getNewTempFile();
558 $fnameArticles = $this->getNewTempFile();
559
560 $dumper = $this->newDumpBackup(
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
566 ],
567 $this->pageId1,
568 $this->pageId4 + 1
569 );
570 $dumper->reporting = true;
571
572 // xmldumps-backup uses reporting. We will not check the exact reported
573 // message, as they are dependent on the processing power of the used
574 // computer. We only check that reporting does not crash the dumping
575 // and that something is reported
576 $dumper->stderr = fopen( 'php://output', 'a' );
577 if ( $dumper->stderr === false ) {
578 $this->fail( "Could not open stream for stderr" );
579 }
580
581 // Performing the dump
582 $dumper->dump( WikiExporter::FULL, WikiExporter::STUB );
583
584 $this->assertTrue( fclose( $dumper->stderr ), "Closing stderr handle" );
585
586 // Checking meta-history -------------------------------------------------
587
588 $this->gunzip( $fnameMetaHistory );
589 $this->assertDumpSchema( $fnameMetaHistory, $this->getXmlSchemaPath( $schemaVersion ) );
590
591 $asserter = $this->getDumpAsserter( $schemaVersion );
592 $asserter->assertDumpStart( $fnameMetaHistory );
593
594 // Page 1
595 $asserter->assertPageStart(
596 $this->pageId1,
597 $this->namespace,
598 $this->pageTitle1->getPrefixedText()
599 );
600 $asserter->assertRevision(
601 $this->revId1_1,
602 "BackupDumperTestP1Summary1",
603 $this->textId1_1,
604 23,
605 "0bolhl6ol7i6x0e7yq91gxgaan39j87"
606 );
607 $asserter->assertPageEnd();
608
609 // Page 2
610 $asserter->assertPageStart(
611 $this->pageId2,
612 $this->namespace,
613 $this->pageTitle2->getPrefixedText()
614 );
615 $asserter->assertRevision(
616 $this->revId2_1,
617 "BackupDumperTestP2Summary1",
618 $this->textId2_1,
619 23,
620 "jprywrymfhysqllua29tj3sc7z39dl2"
621 );
622 $asserter->assertRevision(
623 $this->revId2_2,
624 "BackupDumperTestP2Summary2",
625 $this->textId2_2,
626 23,
627 "b7vj5ks32po5m1z1t1br4o7scdwwy95",
628 false,
629 $this->revId2_1
630 );
631 $asserter->assertRevision(
632 $this->revId2_3,
633 "BackupDumperTestP2Summary3",
634 $this->textId2_3,
635 23,
636 "jfunqmh1ssfb8rs43r19w98k28gg56r",
637 false,
638 $this->revId2_2
639 );
640 $asserter->assertRevision(
641 $this->revId2_4,
642 "BackupDumperTestP2Summary4 extra",
643 $this->textId2_4,
644 44,
645 "6o1ciaxa6pybnqprmungwofc4lv00wv",
646 false,
647 $this->revId2_3
648 );
649 $asserter->assertPageEnd();
650
651 // Page 3
652 // -> Page is marked deleted. Hence not visible
653
654 // Page 4
655 $asserter->assertPageStart(
656 $this->pageId4,
657 $this->talk_namespace,
658 $this->pageTitle4->getPrefixedText( $schemaVersion )
659 );
660 $asserter->assertRevision(
661 $this->revId4_1,
662 "Talk BackupDumperTestP1 Summary1",
663 $this->textId4_1,
664 35,
665 "nktofwzd0tl192k3zfepmlzxoax1lpe"
666 );
667 $asserter->assertPageEnd();
668
669 $asserter->assertDumpEnd();
670
671 // Checking meta-current -------------------------------------------------
672
673 $this->gunzip( $fnameMetaCurrent );
674 $this->assertDumpSchema( $fnameMetaCurrent, $this->getXmlSchemaPath( $schemaVersion ) );
675
676 $asserter = $this->getDumpAsserter( $schemaVersion );
677 $asserter->assertDumpStart( $fnameMetaCurrent );
678
679 // Page 1
680 $asserter->assertPageStart(
681 $this->pageId1,
682 $this->namespace,
683 $this->pageTitle1->getPrefixedText()
684 );
685 $asserter->assertRevision(
686 $this->revId1_1,
687 "BackupDumperTestP1Summary1",
688 $this->textId1_1,
689 23,
690 "0bolhl6ol7i6x0e7yq91gxgaan39j87"
691 );
692 $asserter->assertPageEnd();
693
694 // Page 2
695 $asserter->assertPageStart(
696 $this->pageId2,
697 $this->namespace,
698 $this->pageTitle2->getPrefixedText()
699 );
700 $asserter->assertRevision(
701 $this->revId2_4,
702 "BackupDumperTestP2Summary4 extra",
703 $this->textId2_4,
704 44,
705 "6o1ciaxa6pybnqprmungwofc4lv00wv",
706 false,
707 $this->revId2_3
708 );
709 $asserter->assertPageEnd();
710
711 // Page 3
712 // -> Page is marked deleted. Hence not visible
713
714 // Page 4
715 $asserter->assertPageStart(
716 $this->pageId4,
717 $this->talk_namespace,
718 $this->pageTitle4->getPrefixedText()
719 );
720 $asserter->assertRevision(
721 $this->revId4_1,
722 "Talk BackupDumperTestP1 Summary1",
723 $this->textId4_1,
724 35,
725 "nktofwzd0tl192k3zfepmlzxoax1lpe"
726 );
727 $asserter->assertPageEnd();
728
729 $asserter->assertDumpEnd();
730
731 // Checking articles -------------------------------------------------
732
733 $this->gunzip( $fnameArticles );
734 $this->assertDumpSchema( $fnameArticles, $this->getXmlSchemaPath( $schemaVersion ) );
735
736 $asserter = $this->getDumpAsserter( $schemaVersion );
737 $asserter->assertDumpStart( $fnameArticles );
738
739 // Page 1
740 $asserter->assertPageStart(
741 $this->pageId1,
742 $this->namespace,
743 $this->pageTitle1->getPrefixedText()
744 );
745 $asserter->assertRevision(
746 $this->revId1_1,
747 "BackupDumperTestP1Summary1",
748 $this->textId1_1,
749 23,
750 "0bolhl6ol7i6x0e7yq91gxgaan39j87"
751 );
752 $asserter->assertPageEnd();
753
754 // Page 2
755 $asserter->assertPageStart(
756 $this->pageId2,
757 $this->namespace,
758 $this->pageTitle2->getPrefixedText()
759 );
760 $asserter->assertRevision(
761 $this->revId2_4,
762 "BackupDumperTestP2Summary4 extra",
763 $this->textId2_4,
764 44,
765 "6o1ciaxa6pybnqprmungwofc4lv00wv",
766 false,
767 $this->revId2_3
768 );
769 $asserter->assertPageEnd();
770
771 // Page 3
772 // -> Page is marked deleted. Hence not visible
773
774 // Page 4
775 // -> Page is not in $this->namespace. Hence not visible
776
777 $asserter->assertDumpEnd();
778
779 $this->expectETAOutput();
780 }
781}
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
if(defined( 'MW_SETUP_CALLBACK')) $fname
Customization point after all loading (constants, functions, classes, DefaultSettings,...
Definition Setup.php:123
MediaWiki exception.
getDefaultWikitextNS()
Returns the ID of a namespace that defaults to Wikitext.
Database $db
Primary database.
getNewTempFile()
Obtains a new temporary file name.
static setupDatabaseWithTestPrefix(IMaintainableDatabase $db, $prefix=null)
Setups a database with cloned tables using the given prefix.
copyTestData(IDatabase $source, IDatabase $target)
Copy test data from one database connection to another.
MediaWikiServices is the service locator for the application scope of MediaWiki.
static getInstance()
Returns the global default instance of the top level service locator.
Tests for page dumps of BackupDumper.
testFullStubPlain( $schemaVersion)
schemaVersionProvider
testFullTextPlain( $schemaVersion)
schemaVersionProvider
testXmlDumpsBackupUseCase( $schemaVersion)
xmldumps-backup typically performs a single dump that that writes out three files
testCurrentStubPlain( $schemaVersion)
schemaVersionProvider
newStreamingDBConnection()
Returns a new database connection which is separate from the conenctions returned by the default Load...
gunzip( $fname)
gunzips the given file and stores the result in the original file name
assertDumpSchema( $fname, $schemaFile)
Checks an XML file against an XSD schema.
addRevision(WikiPage $page, $text, $summary, $model=CONTENT_MODEL_WIKITEXT)
Adds a revision to a page, while returning the resuting revision's id.
expectETAOutput()
Checks for test output consisting only of lines containing ETA announcements.
checkHasGzip()
Skip the test if 'gzip' is not in $PATH.
getXmlSchemaPath( $schemaVersion=null)
Returns the path to the XML schema file for the given schema version.
Represents a title within MediaWiki.
Definition Title.php:40
Class representing a MediaWiki article and history.
Definition WikiPage.php:45
Database connection, tracking, load balancing, and transaction manager for a cluster.
static string[] $supportedSchemas
the schema versions supported for output @final
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
Definition deferred.txt:11
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
const CONTENT_MODEL_WIKITEXT
Definition Defines.php:244
const CONTENT_FORMAT_WIKITEXT
Definition Defines.php:259
const NS_TALK
Definition Defines.php:74
returning false will NOT prevent logging $e
Definition hooks.txt:2175
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition injection.txt:37
Basic database interface for live and lazy-loaded relation database handles.
Definition IDatabase.php:38
const DB_REPLICA
Definition defines.php:25