MediaWiki  1.23.8
backupTextPassTest.php
Go to the documentation of this file.
1 <?php
2 
3 require_once __DIR__ . "/../../../maintenance/backupTextPass.inc";
4 
13 
14  // We'll add several pages, revision and texts. The following variables hold the
15  // corresponding ids.
17  private static $numOfPages = 4;
23  private static $numOfRevs = 8;
24 
25  function addDBData() {
26  $this->tablesUsed[] = 'page';
27  $this->tablesUsed[] = 'revision';
28  $this->tablesUsed[] = 'text';
29 
30  $ns = $this->getDefaultWikitextNS();
31 
32  try {
33  // Simple page
34  $title = Title::newFromText( 'BackupDumperTestP1', $ns );
35  $page = WikiPage::factory( $title );
36  list( $this->revId1_1, $this->textId1_1 ) = $this->addRevision( $page,
37  "BackupDumperTestP1Text1", "BackupDumperTestP1Summary1" );
38  $this->pageId1 = $page->getId();
39 
40  // Page with more than one revision
41  $title = Title::newFromText( 'BackupDumperTestP2', $ns );
42  $page = WikiPage::factory( $title );
43  list( $this->revId2_1, $this->textId2_1 ) = $this->addRevision( $page,
44  "BackupDumperTestP2Text1", "BackupDumperTestP2Summary1" );
45  list( $this->revId2_2, $this->textId2_2 ) = $this->addRevision( $page,
46  "BackupDumperTestP2Text2", "BackupDumperTestP2Summary2" );
47  list( $this->revId2_3, $this->textId2_3 ) = $this->addRevision( $page,
48  "BackupDumperTestP2Text3", "BackupDumperTestP2Summary3" );
49  list( $this->revId2_4, $this->textId2_4 ) = $this->addRevision( $page,
50  "BackupDumperTestP2Text4 some additional Text ",
51  "BackupDumperTestP2Summary4 extra " );
52  $this->pageId2 = $page->getId();
53 
54  // Deleted page.
55  $title = Title::newFromText( 'BackupDumperTestP3', $ns );
56  $page = WikiPage::factory( $title );
57  list( $this->revId3_1, $this->textId3_1 ) = $this->addRevision( $page,
58  "BackupDumperTestP3Text1", "BackupDumperTestP2Summary1" );
59  list( $this->revId3_2, $this->textId3_2 ) = $this->addRevision( $page,
60  "BackupDumperTestP3Text2", "BackupDumperTestP2Summary2" );
61  $this->pageId3 = $page->getId();
62  $page->doDeleteArticle( "Testing ;)" );
63 
64  // Page from non-default namespace
65 
66  if ( $ns === NS_TALK ) {
67  // @todo work around this.
68  throw new MWException( "The default wikitext namespace is the talk namespace. "
69  . " We can't currently deal with that." );
70  }
71 
72  $title = Title::newFromText( 'BackupDumperTestP1', NS_TALK );
73  $page = WikiPage::factory( $title );
74  list( $this->revId4_1, $this->textId4_1 ) = $this->addRevision( $page,
75  "Talk about BackupDumperTestP1 Text1",
76  "Talk BackupDumperTestP1 Summary1" );
77  $this->pageId4 = $page->getId();
78  } catch ( Exception $e ) {
79  // We'd love to pass $e directly. However, ... see
80  // documentation of exceptionFromAddDBData in
81  // DumpTestCase
82  $this->exceptionFromAddDBData = $e;
83  }
84  }
85 
86  protected function setUp() {
87  parent::setUp();
88 
89  // Since we will restrict dumping by page ranges (to allow
90  // working tests, even if the db gets prepopulated by a base
91  // class), we have to assert, that the page id are consecutively
92  // increasing
93  $this->assertEquals(
94  array( $this->pageId2, $this->pageId3, $this->pageId4 ),
95  array( $this->pageId1 + 1, $this->pageId2 + 1, $this->pageId3 + 1 ),
96  "Page ids increasing without holes" );
97  }
98 
99  function testPlain() {
100  // Setting up the dump
101  $nameStub = $this->setUpStub();
102  $nameFull = $this->getNewTempFile();
103  $dumper = new TextPassDumper( array( "--stub=file:" . $nameStub,
104  "--output=file:" . $nameFull ) );
105  $dumper->reporting = false;
106  $dumper->setDb( $this->db );
107 
108  // Performing the dump
110 
111  // Checking for correctness of the dumped data
112  $this->assertDumpStart( $nameFull );
113 
114  // Page 1
115  $this->assertPageStart( $this->pageId1, NS_MAIN, "BackupDumperTestP1" );
116  $this->assertRevision( $this->revId1_1, "BackupDumperTestP1Summary1",
117  $this->textId1_1, false, "0bolhl6ol7i6x0e7yq91gxgaan39j87",
118  "BackupDumperTestP1Text1" );
119  $this->assertPageEnd();
120 
121  // Page 2
122  $this->assertPageStart( $this->pageId2, NS_MAIN, "BackupDumperTestP2" );
123  $this->assertRevision( $this->revId2_1, "BackupDumperTestP2Summary1",
124  $this->textId2_1, false, "jprywrymfhysqllua29tj3sc7z39dl2",
125  "BackupDumperTestP2Text1" );
126  $this->assertRevision( $this->revId2_2, "BackupDumperTestP2Summary2",
127  $this->textId2_2, false, "b7vj5ks32po5m1z1t1br4o7scdwwy95",
128  "BackupDumperTestP2Text2", $this->revId2_1 );
129  $this->assertRevision( $this->revId2_3, "BackupDumperTestP2Summary3",
130  $this->textId2_3, false, "jfunqmh1ssfb8rs43r19w98k28gg56r",
131  "BackupDumperTestP2Text3", $this->revId2_2 );
132  $this->assertRevision( $this->revId2_4, "BackupDumperTestP2Summary4 extra",
133  $this->textId2_4, false, "6o1ciaxa6pybnqprmungwofc4lv00wv",
134  "BackupDumperTestP2Text4 some additional Text", $this->revId2_3 );
135  $this->assertPageEnd();
136 
137  // Page 3
138  // -> Page is marked deleted. Hence not visible
139 
140  // Page 4
141  $this->assertPageStart( $this->pageId4, NS_TALK, "Talk:BackupDumperTestP1" );
142  $this->assertRevision( $this->revId4_1, "Talk BackupDumperTestP1 Summary1",
143  $this->textId4_1, false, "nktofwzd0tl192k3zfepmlzxoax1lpe",
144  "Talk about BackupDumperTestP1 Text1" );
145  $this->assertPageEnd();
146 
147  $this->assertDumpEnd();
148  }
149 
150  function testPrefetchPlain() {
151  // The mapping between ids and text, for the hits of the prefetch mock
152  $prefetchMap = array(
153  array( $this->pageId1, $this->revId1_1, "Prefetch_________1Text1" ),
154  array( $this->pageId2, $this->revId2_3, "Prefetch_________2Text3" )
155  );
156 
157  // The mock itself
158  $prefetchMock = $this->getMock( 'BaseDump', array( 'prefetch' ), array(), '', false );
159  $prefetchMock->expects( $this->exactly( 6 ) )
160  ->method( 'prefetch' )
161  ->will( $this->returnValueMap( $prefetchMap ) );
162 
163  // Setting up of the dump
164  $nameStub = $this->setUpStub();
165  $nameFull = $this->getNewTempFile();
166  $dumper = new TextPassDumper( array( "--stub=file:"
167  . $nameStub, "--output=file:" . $nameFull ) );
168  $dumper->prefetch = $prefetchMock;
169  $dumper->reporting = false;
170  $dumper->setDb( $this->db );
171 
172  // Performing the dump
174 
175  // Checking for correctness of the dumped data
176  $this->assertDumpStart( $nameFull );
177 
178  // Page 1
179  $this->assertPageStart( $this->pageId1, NS_MAIN, "BackupDumperTestP1" );
180  // Prefetch kicks in. This is still the SHA-1 of the original text,
181  // But the actual text (with different SHA-1) comes from prefetch.
182  $this->assertRevision( $this->revId1_1, "BackupDumperTestP1Summary1",
183  $this->textId1_1, false, "0bolhl6ol7i6x0e7yq91gxgaan39j87",
184  "Prefetch_________1Text1" );
185  $this->assertPageEnd();
186 
187  // Page 2
188  $this->assertPageStart( $this->pageId2, NS_MAIN, "BackupDumperTestP2" );
189  $this->assertRevision( $this->revId2_1, "BackupDumperTestP2Summary1",
190  $this->textId2_1, false, "jprywrymfhysqllua29tj3sc7z39dl2",
191  "BackupDumperTestP2Text1" );
192  $this->assertRevision( $this->revId2_2, "BackupDumperTestP2Summary2",
193  $this->textId2_2, false, "b7vj5ks32po5m1z1t1br4o7scdwwy95",
194  "BackupDumperTestP2Text2", $this->revId2_1 );
195  // Prefetch kicks in. This is still the SHA-1 of the original text,
196  // But the actual text (with different SHA-1) comes from prefetch.
197  $this->assertRevision( $this->revId2_3, "BackupDumperTestP2Summary3",
198  $this->textId2_3, false, "jfunqmh1ssfb8rs43r19w98k28gg56r",
199  "Prefetch_________2Text3", $this->revId2_2 );
200  $this->assertRevision( $this->revId2_4, "BackupDumperTestP2Summary4 extra",
201  $this->textId2_4, false, "6o1ciaxa6pybnqprmungwofc4lv00wv",
202  "BackupDumperTestP2Text4 some additional Text", $this->revId2_3 );
203  $this->assertPageEnd();
204 
205  // Page 3
206  // -> Page is marked deleted. Hence not visible
207 
208  // Page 4
209  $this->assertPageStart( $this->pageId4, NS_TALK, "Talk:BackupDumperTestP1" );
210  $this->assertRevision( $this->revId4_1, "Talk BackupDumperTestP1 Summary1",
211  $this->textId4_1, false, "nktofwzd0tl192k3zfepmlzxoax1lpe",
212  "Talk about BackupDumperTestP1 Text1" );
213  $this->assertPageEnd();
214 
215  $this->assertDumpEnd();
216  }
217 
225  private function checkpointHelper( $checkpointFormat = "file" ) {
226  // Getting temporary names
227  $nameStub = $this->getNewTempFile();
228  $nameOutputDir = $this->getNewTempDirectory();
229 
230  $stderr = fopen( 'php://output', 'a' );
231  if ( $stderr === false ) {
232  $this->fail( "Could not open stream for stderr" );
233  }
234 
235  $iterations = 32; // We'll start with that many iterations of revisions in stub
236  $lastDuration = 0;
237  $minDuration = 2; // We want the dump to take at least this many seconds
238  $checkpointAfter = 0.5; // Generate checkpoint after this many seconds
239 
240  // Until a dump takes at least $minDuration seconds, perform a dump and check
241  // duration. If the dump did not take long enough increase the iteration
242  // count, to generate a bigger stub file next time.
243  while ( $lastDuration < $minDuration ) {
244 
245  // Setting up the dump
246  wfRecursiveRemoveDir( $nameOutputDir );
247  $this->assertTrue( wfMkdirParents( $nameOutputDir ),
248  "Creating temporary output directory " );
249  $this->setUpStub( $nameStub, $iterations );
250  $dumper = new TextPassDumper( array( "--stub=file:" . $nameStub,
251  "--output=" . $checkpointFormat . ":" . $nameOutputDir . "/full",
252  "--maxtime=1" /*This is in minutes. Fixup is below*/,
253  "--checkpointfile=checkpoint-%s-%s.xml.gz" ) );
254  $dumper->setDb( $this->db );
255  $dumper->maxTimeAllowed = $checkpointAfter; // Patching maxTime from 1 minute
256  $dumper->stderr = $stderr;
257 
258  // The actual dump and taking time
259  $ts_before = microtime( true );
261  $ts_after = microtime( true );
262  $lastDuration = $ts_after - $ts_before;
263 
264  // Handling increasing the iteration count for the stubs
265  if ( $lastDuration < $minDuration ) {
266  $old_iterations = $iterations;
267  if ( $lastDuration > 0.2 ) {
268  // lastDuration is big enough, to allow an educated guess
269  $factor = ( $minDuration + 0.5 ) / $lastDuration;
270  if ( ( $factor > 1.1 ) && ( $factor < 100 ) ) {
271  // educated guess is reasonable
272  $iterations = (int)( $iterations * $factor );
273  }
274  }
275 
276  if ( $old_iterations == $iterations ) {
277  // Heuristics were not applied, so we just *2.
278  $iterations *= 2;
279  }
280 
281  $this->assertLessThan( 50000, $iterations,
282  "Emergency stop against infinitely increasing iteration "
283  . "count ( last duration: $lastDuration )" );
284  }
285  }
286 
287  // The dump (hopefully) did take long enough to produce more than one
288  // checkpoint file.
289  //
290  // We now check all the checkpoint files for validity.
291 
292  $files = scandir( $nameOutputDir );
293  $this->assertTrue( asort( $files ), "Sorting files in temporary directory" );
294  $fileOpened = false;
295  $lookingForPage = 1;
296  $checkpointFiles = 0;
297 
298  // Each run of the following loop body tries to handle exactly 1 /page/ (not
299  // iteration of stub content). $i is only increased after having treated page 4.
300  for ( $i = 0; $i < $iterations; ) {
301 
302  // 1. Assuring a file is opened and ready. Skipping across header if
303  // necessary.
304  if ( !$fileOpened ) {
305  $this->assertNotEmpty( $files, "No more existing dump files, "
306  . "but not yet all pages found" );
307  $fname = array_shift( $files );
308  while ( $fname == "." || $fname == ".." ) {
309  $this->assertNotEmpty( $files, "No more existing dump"
310  . " files, but not yet all pages found" );
311  $fname = array_shift( $files );
312  }
313  if ( $checkpointFormat == "gzip" ) {
314  $this->gunzip( $nameOutputDir . "/" . $fname );
315  }
316  $this->assertDumpStart( $nameOutputDir . "/" . $fname );
317  $fileOpened = true;
318  $checkpointFiles++;
319  }
320 
321  // 2. Performing a single page check
322  switch ( $lookingForPage ) {
323  case 1:
324  // Page 1
325  $this->assertPageStart( $this->pageId1 + $i * self::$numOfPages, NS_MAIN,
326  "BackupDumperTestP1" );
327  $this->assertRevision( $this->revId1_1 + $i * self::$numOfRevs, "BackupDumperTestP1Summary1",
328  $this->textId1_1, false, "0bolhl6ol7i6x0e7yq91gxgaan39j87",
329  "BackupDumperTestP1Text1" );
330  $this->assertPageEnd();
331 
332  $lookingForPage = 2;
333  break;
334 
335  case 2:
336  // Page 2
337  $this->assertPageStart( $this->pageId2 + $i * self::$numOfPages, NS_MAIN,
338  "BackupDumperTestP2" );
339  $this->assertRevision( $this->revId2_1 + $i * self::$numOfRevs, "BackupDumperTestP2Summary1",
340  $this->textId2_1, false, "jprywrymfhysqllua29tj3sc7z39dl2",
341  "BackupDumperTestP2Text1" );
342  $this->assertRevision( $this->revId2_2 + $i * self::$numOfRevs, "BackupDumperTestP2Summary2",
343  $this->textId2_2, false, "b7vj5ks32po5m1z1t1br4o7scdwwy95",
344  "BackupDumperTestP2Text2", $this->revId2_1 + $i * self::$numOfRevs );
345  $this->assertRevision( $this->revId2_3 + $i * self::$numOfRevs, "BackupDumperTestP2Summary3",
346  $this->textId2_3, false, "jfunqmh1ssfb8rs43r19w98k28gg56r",
347  "BackupDumperTestP2Text3", $this->revId2_2 + $i * self::$numOfRevs );
348  $this->assertRevision( $this->revId2_4 + $i * self::$numOfRevs,
349  "BackupDumperTestP2Summary4 extra",
350  $this->textId2_4, false, "6o1ciaxa6pybnqprmungwofc4lv00wv",
351  "BackupDumperTestP2Text4 some additional Text",
352  $this->revId2_3 + $i * self::$numOfRevs );
353  $this->assertPageEnd();
354 
355  $lookingForPage = 4;
356  break;
357 
358  case 4:
359  // Page 4
360  $this->assertPageStart( $this->pageId4 + $i * self::$numOfPages, NS_TALK,
361  "Talk:BackupDumperTestP1" );
362  $this->assertRevision( $this->revId4_1 + $i * self::$numOfRevs,
363  "Talk BackupDumperTestP1 Summary1",
364  $this->textId4_1, false, "nktofwzd0tl192k3zfepmlzxoax1lpe",
365  "Talk about BackupDumperTestP1 Text1" );
366  $this->assertPageEnd();
367 
368  $lookingForPage = 1;
369 
370  // We dealt with the whole iteration.
371  $i++;
372  break;
373 
374  default:
375  $this->fail( "Bad setting for lookingForPage ($lookingForPage)" );
376  }
377 
378  // 3. Checking for the end of the current checkpoint file
379  if ( $this->xml->nodeType == XMLReader::END_ELEMENT
380  && $this->xml->name == "mediawiki"
381  ) {
382  $this->assertDumpEnd();
383  $fileOpened = false;
384  }
385  }
386 
387  // Assuring we completely read all files ...
388  $this->assertFalse( $fileOpened, "Currently read file still open?" );
389  $this->assertEmpty( $files, "Remaining unchecked files" );
390 
391  // ... and have dealt with more than one checkpoint file
392  $this->assertGreaterThan( 1, $checkpointFiles, "expected more than 1 checkpoint to have been created. Checkpoint interval is $checkpointAfter seconds, maybe your computer is too fast?" );
393 
394  $this->expectETAOutput();
395  }
396 
400  function testCheckpointPlain() {
401  $this->checkpointHelper();
402  }
403 
416  function testCheckpointGzip() {
417  $this->checkHasGzip();
418  $this->checkpointHelper( "gzip" );
419  }
420 
436  private function setUpStub( $fname = null, $iterations = 1 ) {
437  if ( $fname === null ) {
438  $fname = $this->getNewTempFile();
439  }
440  $header = '<mediawiki xmlns="http://www.mediawiki.org/xml/export-0.7/" '
441  . 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" '
442  . 'xsi:schemaLocation="http://www.mediawiki.org/xml/export-0.7/ '
443  . 'http://www.mediawiki.org/xml/export-0.7.xsd" version="0.7" xml:lang="en">
444  <siteinfo>
445  <sitename>wikisvn</sitename>
446  <base>http://localhost/wiki-svn/index.php/Main_Page</base>
447  <generator>MediaWiki 1.21alpha</generator>
448  <case>first-letter</case>
449  <namespaces>
450  <namespace key="-2" case="first-letter">Media</namespace>
451  <namespace key="-1" case="first-letter">Special</namespace>
452  <namespace key="0" case="first-letter" />
453  <namespace key="1" case="first-letter">Talk</namespace>
454  <namespace key="2" case="first-letter">User</namespace>
455  <namespace key="3" case="first-letter">User talk</namespace>
456  <namespace key="4" case="first-letter">Wikisvn</namespace>
457  <namespace key="5" case="first-letter">Wikisvn talk</namespace>
458  <namespace key="6" case="first-letter">File</namespace>
459  <namespace key="7" case="first-letter">File talk</namespace>
460  <namespace key="8" case="first-letter">MediaWiki</namespace>
461  <namespace key="9" case="first-letter">MediaWiki talk</namespace>
462  <namespace key="10" case="first-letter">Template</namespace>
463  <namespace key="11" case="first-letter">Template talk</namespace>
464  <namespace key="12" case="first-letter">Help</namespace>
465  <namespace key="13" case="first-letter">Help talk</namespace>
466  <namespace key="14" case="first-letter">Category</namespace>
467  <namespace key="15" case="first-letter">Category talk</namespace>
468  </namespaces>
469  </siteinfo>
470 ';
471  $tail = '</mediawiki>
472 ';
473 
474  $content = $header;
475  $iterations = intval( $iterations );
476  for ( $i = 0; $i < $iterations; $i++ ) {
477 
478  $page1 = ' <page>
479  <title>BackupDumperTestP1</title>
480  <ns>0</ns>
481  <id>' . ( $this->pageId1 + $i * self::$numOfPages ) . '</id>
482  <revision>
483  <id>' . ( $this->revId1_1 + $i * self::$numOfRevs ) . '</id>
484  <timestamp>2012-04-01T16:46:05Z</timestamp>
485  <contributor>
486  <ip>127.0.0.1</ip>
487  </contributor>
488  <comment>BackupDumperTestP1Summary1</comment>
489  <sha1>0bolhl6ol7i6x0e7yq91gxgaan39j87</sha1>
490  <model>wikitext</model>
491  <format>text/x-wiki</format>
492  <text id="' . $this->textId1_1 . '" bytes="23" />
493  </revision>
494  </page>
495 ';
496  $page2 = ' <page>
497  <title>BackupDumperTestP2</title>
498  <ns>0</ns>
499  <id>' . ( $this->pageId2 + $i * self::$numOfPages ) . '</id>
500  <revision>
501  <id>' . ( $this->revId2_1 + $i * self::$numOfRevs ) . '</id>
502  <timestamp>2012-04-01T16:46:05Z</timestamp>
503  <contributor>
504  <ip>127.0.0.1</ip>
505  </contributor>
506  <comment>BackupDumperTestP2Summary1</comment>
507  <sha1>jprywrymfhysqllua29tj3sc7z39dl2</sha1>
508  <model>wikitext</model>
509  <format>text/x-wiki</format>
510  <text id="' . $this->textId2_1 . '" bytes="23" />
511  </revision>
512  <revision>
513  <id>' . ( $this->revId2_2 + $i * self::$numOfRevs ) . '</id>
514  <parentid>' . ( $this->revId2_1 + $i * self::$numOfRevs ) . '</parentid>
515  <timestamp>2012-04-01T16:46:05Z</timestamp>
516  <contributor>
517  <ip>127.0.0.1</ip>
518  </contributor>
519  <comment>BackupDumperTestP2Summary2</comment>
520  <sha1>b7vj5ks32po5m1z1t1br4o7scdwwy95</sha1>
521  <model>wikitext</model>
522  <format>text/x-wiki</format>
523  <text id="' . $this->textId2_2 . '" bytes="23" />
524  </revision>
525  <revision>
526  <id>' . ( $this->revId2_3 + $i * self::$numOfRevs ) . '</id>
527  <parentid>' . ( $this->revId2_2 + $i * self::$numOfRevs ) . '</parentid>
528  <timestamp>2012-04-01T16:46:05Z</timestamp>
529  <contributor>
530  <ip>127.0.0.1</ip>
531  </contributor>
532  <comment>BackupDumperTestP2Summary3</comment>
533  <sha1>jfunqmh1ssfb8rs43r19w98k28gg56r</sha1>
534  <model>wikitext</model>
535  <format>text/x-wiki</format>
536  <text id="' . $this->textId2_3 . '" bytes="23" />
537  </revision>
538  <revision>
539  <id>' . ( $this->revId2_4 + $i * self::$numOfRevs ) . '</id>
540  <parentid>' . ( $this->revId2_3 + $i * self::$numOfRevs ) . '</parentid>
541  <timestamp>2012-04-01T16:46:05Z</timestamp>
542  <contributor>
543  <ip>127.0.0.1</ip>
544  </contributor>
545  <comment>BackupDumperTestP2Summary4 extra</comment>
546  <sha1>6o1ciaxa6pybnqprmungwofc4lv00wv</sha1>
547  <model>wikitext</model>
548  <format>text/x-wiki</format>
549  <text id="' . $this->textId2_4 . '" bytes="44" />
550  </revision>
551  </page>
552 ';
553  // page 3 not in stub
554 
555  $page4 = ' <page>
556  <title>Talk:BackupDumperTestP1</title>
557  <ns>1</ns>
558  <id>' . ( $this->pageId4 + $i * self::$numOfPages ) . '</id>
559  <revision>
560  <id>' . ( $this->revId4_1 + $i * self::$numOfRevs ) . '</id>
561  <timestamp>2012-04-01T16:46:05Z</timestamp>
562  <contributor>
563  <ip>127.0.0.1</ip>
564  </contributor>
565  <comment>Talk BackupDumperTestP1 Summary1</comment>
566  <sha1>nktofwzd0tl192k3zfepmlzxoax1lpe</sha1>
567  <model>wikitext</model>
568  <format>text/x-wiki</format>
569  <text id="' . $this->textId4_1 . '" bytes="35" />
570  </revision>
571  </page>
572 ';
573  $content .= $page1 . $page2 . $page4;
574  }
575  $content .= $tail;
576  $this->assertEquals( strlen( $content ), file_put_contents(
577  $fname, $content ), "Length of prepared stub" );
578 
579  return $fname;
580  }
581 }
TextPassDumperTest\$pageId4
$pageId4
Definition: backupTextPassTest.php:16
Title\newFromText
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
Definition: Title.php:189
DumpTestCase
Base TestCase for dumps.
Definition: DumpTestCase.php:6
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
$files
$files
Definition: importImages.php:67
$dumper
$dumper
Definition: dumpBackup.php:35
TextPassDumperTest\$revId2_1
$revId2_1
Definition: backupTextPassTest.php:19
DumpTestCase\assertPageEnd
assertPageEnd()
Asserts that the xml reader is at the page's closing element and skips to the next element.
Definition: DumpTestCase.php:280
TextPassDumperTest\$pageId1
$pageId1
Definition: backupTextPassTest.php:16
wfMkdirParents
wfMkdirParents( $dir, $mode=null, $caller=null)
Make directory, and make all parent directories if they don't exist.
Definition: GlobalFunctions.php:2590
TextPassDumperTest\$revId2_3
$revId2_3
Definition: backupTextPassTest.php:20
$fname
if(!defined( 'MEDIAWIKI')) $fname
This file is not a valid entry point, perform no further processing unless MEDIAWIKI is defined.
Definition: Setup.php:35
fail
as a message key or array as accepted by ApiBase::dieUsageMsg after processing request parameters Return false to let the request fail
Definition: hooks.txt:375
TextPassDumperTest\addDBData
addDBData()
Stub.
Definition: backupTextPassTest.php:25
TextPassDumperTest\setUpStub
setUpStub( $fname=null, $iterations=1)
Creates a stub file that is used for testing the text pass of dumps.
Definition: backupTextPassTest.php:436
TextPassDumperTest\testPrefetchPlain
testPrefetchPlain()
Definition: backupTextPassTest.php:150
DumpTestCase\assertDumpEnd
assertDumpEnd( $name="mediawiki")
Asserts that the xml reader is at the final closing tag of an xml file and closes the reader.
Definition: DumpTestCase.php:176
TextPassDumperTest\$textId3_1
$textId3_1
Definition: backupTextPassTest.php:21
TextPassDumperTest\$revId1_1
$revId1_1
Definition: backupTextPassTest.php:18
NS_MAIN
const NS_MAIN
Definition: Defines.php:79
TextPassDumperTest\$numOfPages
static $numOfPages
Definition: backupTextPassTest.php:17
MWException
MediaWiki exception.
Definition: MWException.php:26
TextPassDumperTest\$numOfRevs
static $numOfRevs
Definition: backupTextPassTest.php:23
WikiPage\factory
static factory(Title $title)
Create a WikiPage object of the appropriate class for the given title.
Definition: WikiPage.php:103
TextPassDumperTest\testCheckpointPlain
testCheckpointPlain()
@group large
Definition: backupTextPassTest.php:400
WikiExporter\TEXT
const TEXT
Definition: Export.php:49
TextPassDumperTest\$revId2_4
$revId2_4
Definition: backupTextPassTest.php:20
MediaWikiTestCase\getNewTempFile
getNewTempFile()
Obtains a new temporary file name.
Definition: MediaWikiTestCase.php:156
TextPassDumperTest\$revId3_1
$revId3_1
Definition: backupTextPassTest.php:21
DumpTestCase\assertPageStart
assertPageStart( $id, $ns, $name)
Asserts that the xml reader is at the start of a page element and skips over the first tags,...
Definition: DumpTestCase.php:266
TextPassDumperTest
Tests for page dumps of BackupDumper.
Definition: backupTextPassTest.php:12
TextPassDumperTest\$textId2_4
$textId2_4
Definition: backupTextPassTest.php:20
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
MediaWikiTestCase\getDefaultWikitextNS
getDefaultWikitextNS()
Returns the ID of a namespace that defaults to Wikitext.
Definition: MediaWikiTestCase.php:903
DumpTestCase\expectETAOutput
expectETAOutput()
Checks for test output consisting only of lines containing ETA announcements.
Definition: DumpTestCase.php:90
TextPassDumperTest\setUp
setUp()
Default set up function.
Definition: backupTextPassTest.php:86
list
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
TextPassDumperTest\$pageId3
$pageId3
Definition: backupTextPassTest.php:16
MediaWikiTestCase\checkHasGzip
checkHasGzip()
Check whether we have the 'gzip' commandline utility, will skip the test whenever "gzip -V" fails.
Definition: MediaWikiTestCase.php:983
TextPassDumperTest\testPlain
testPlain()
Definition: backupTextPassTest.php:99
TextPassDumperTest\$revId3_2
$revId3_2
Definition: backupTextPassTest.php:21
$title
presenting them properly to the user as errors is done by the caller $title
Definition: hooks.txt:1324
TextPassDumperTest\$pageId2
$pageId2
Definition: backupTextPassTest.php:16
TextPassDumperTest\$revId4_1
$revId4_1
Definition: backupTextPassTest.php:22
WikiExporter\FULL
const FULL
Definition: Export.php:40
TextPassDumperTest\$revId2_2
$revId2_2
Definition: backupTextPassTest.php:19
TextPassDumperTest\$textId4_1
$textId4_1
Definition: backupTextPassTest.php:22
DumpTestCase\assertDumpStart
assertDumpStart( $fname, $skip_siteinfo=true)
Opens an XML file to analyze and optionally skips past siteinfo.
Definition: DumpTestCase.php:159
TextPassDumperTest\$textId3_2
$textId3_2
Definition: backupTextPassTest.php:21
wfRecursiveRemoveDir
wfRecursiveRemoveDir( $dir)
Remove a directory and all its content.
Definition: GlobalFunctions.php:2632
TextPassDumperTest\$textId2_3
$textId2_3
Definition: backupTextPassTest.php:20
TextPassDumperTest\$textId1_1
$textId1_1
Definition: backupTextPassTest.php:18
DumpTestCase\gunzip
gunzip( $fname)
gunzips the given file and stores the result in the original file name
Definition: DumpTestCase.php:55
TextPassDumperTest\$textId2_2
$textId2_2
Definition: backupTextPassTest.php:19
TextPassDumperTest\checkpointHelper
checkpointHelper( $checkpointFormat="file")
Ensures that checkpoint dumps are used and written, by successively increasing the stub size and dump...
Definition: backupTextPassTest.php:225
NS_TALK
const NS_TALK
Definition: Defines.php:80
TextPassDumperTest\testCheckpointGzip
testCheckpointGzip()
tests for working checkpoint generation in gzip format work.
Definition: backupTextPassTest.php:416
TextPassDumper
Definition: backupTextPass.inc:32
$e
if( $useReadline) $e
Definition: eval.php:66
DumpTestCase\assertRevision
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.
Definition: DumpTestCase.php:300
TextPassDumperTest\$textId2_1
$textId2_1
Definition: backupTextPassTest.php:19
MediaWikiTestCase\getNewTempDirectory
getNewTempDirectory()
obtains a new temporary directory
Definition: MediaWikiTestCase.php:173
DumpTestCase\addRevision
addRevision(Page $page, $text, $summary)
Adds a revision to a page, while returning the resuting revision's id.
Definition: DumpTestCase.php:35