26 'wgLanguageCode' =>
'en',
30 $this->tablesUsed[] =
'page';
31 $this->tablesUsed[] =
'revision';
32 $this->tablesUsed[] =
'ip_changes';
33 $this->tablesUsed[] =
'text';
37 $this->talk_namespace =
NS_TALK;
39 if ( $this->
namespace === $this->talk_namespace ) {
41 throw new MWException(
"The default wikitext namespace is the talk namespace. "
42 .
" We can't currently deal with that." );
48 "BackupDumperTestP1Text1",
"BackupDumperTestP1Summary1" );
49 $this->pageId1 = $page->getId();
54 "BackupDumperTestP2Text1",
"BackupDumperTestP2Summary1" );
56 "BackupDumperTestP2Text2",
"BackupDumperTestP2Summary2" );
58 "BackupDumperTestP2Text3",
"BackupDumperTestP2Summary3" );
60 "BackupDumperTestP2Text4 some additional Text ",
61 "BackupDumperTestP2Summary4 extra " );
62 $this->pageId2 = $page->getId();
67 "BackupDumperTestP3Text1",
"BackupDumperTestP2Summary1" );
69 "BackupDumperTestP3Text2",
"BackupDumperTestP2Summary2" );
70 $this->pageId3 = $page->getId();
71 $page->doDeleteArticle(
"Testing ;)" );
76 "Talk about BackupDumperTestP1 Text1",
77 "Talk BackupDumperTestP1 Summary1" );
78 $this->pageId4 = $page->getId();
79 }
catch ( Exception
$e ) {
83 $this->exceptionFromAddDBData =
$e;
95 [ $this->pageId2, $this->pageId3, $this->pageId4 ],
96 [ $this->pageId1 + 1, $this->pageId2 + 1, $this->pageId3 + 1 ],
97 "Page ids increasing without holes" );
105 $dumper->loadWithArgv( [
'--full',
'--quiet',
'--output',
'file:' .
$fname ] );
107 $dumper->endId = $this->pageId4 + 1;
108 $dumper->setDB( $this->db );
117 $this->
assertPageStart( $this->pageId1, $this->
namespace, $this->pageTitle1->getPrefixedText() );
118 $this->
assertRevision( $this->revId1_1,
"BackupDumperTestP1Summary1",
119 $this->textId1_1, 23,
"0bolhl6ol7i6x0e7yq91gxgaan39j87",
120 "BackupDumperTestP1Text1" );
124 $this->
assertPageStart( $this->pageId2, $this->
namespace, $this->pageTitle2->getPrefixedText() );
125 $this->
assertRevision( $this->revId2_1,
"BackupDumperTestP2Summary1",
126 $this->textId2_1, 23,
"jprywrymfhysqllua29tj3sc7z39dl2",
127 "BackupDumperTestP2Text1" );
128 $this->
assertRevision( $this->revId2_2,
"BackupDumperTestP2Summary2",
129 $this->textId2_2, 23,
"b7vj5ks32po5m1z1t1br4o7scdwwy95",
130 "BackupDumperTestP2Text2", $this->revId2_1 );
131 $this->
assertRevision( $this->revId2_3,
"BackupDumperTestP2Summary3",
132 $this->textId2_3, 23,
"jfunqmh1ssfb8rs43r19w98k28gg56r",
133 "BackupDumperTestP2Text3", $this->revId2_2 );
134 $this->
assertRevision( $this->revId2_4,
"BackupDumperTestP2Summary4 extra",
135 $this->textId2_4, 44,
"6o1ciaxa6pybnqprmungwofc4lv00wv",
136 "BackupDumperTestP2Text4 some additional Text", $this->revId2_3 );
145 $this->talk_namespace,
146 $this->pageTitle4->getPrefixedText()
148 $this->
assertRevision( $this->revId4_1,
"Talk BackupDumperTestP1 Summary1",
149 $this->textId4_1, 35,
"nktofwzd0tl192k3zfepmlzxoax1lpe",
150 "Talk about BackupDumperTestP1 Text1" );
161 $dumper->loadWithArgv( [
'--full',
'--quiet',
'--output',
'file:' .
$fname,
'--stub' ] );
163 $dumper->endId = $this->pageId4 + 1;
164 $dumper->setDB( $this->db );
173 $this->
assertPageStart( $this->pageId1, $this->
namespace, $this->pageTitle1->getPrefixedText() );
174 $this->
assertRevision( $this->revId1_1,
"BackupDumperTestP1Summary1",
175 $this->textId1_1, 23,
"0bolhl6ol7i6x0e7yq91gxgaan39j87" );
179 $this->
assertPageStart( $this->pageId2, $this->
namespace, $this->pageTitle2->getPrefixedText() );
180 $this->
assertRevision( $this->revId2_1,
"BackupDumperTestP2Summary1",
181 $this->textId2_1, 23,
"jprywrymfhysqllua29tj3sc7z39dl2" );
182 $this->
assertRevision( $this->revId2_2,
"BackupDumperTestP2Summary2",
183 $this->textId2_2, 23,
"b7vj5ks32po5m1z1t1br4o7scdwwy95",
false, $this->revId2_1 );
184 $this->
assertRevision( $this->revId2_3,
"BackupDumperTestP2Summary3",
185 $this->textId2_3, 23,
"jfunqmh1ssfb8rs43r19w98k28gg56r",
false, $this->revId2_2 );
186 $this->
assertRevision( $this->revId2_4,
"BackupDumperTestP2Summary4 extra",
187 $this->textId2_4, 44,
"6o1ciaxa6pybnqprmungwofc4lv00wv",
false, $this->revId2_3 );
196 $this->talk_namespace,
197 $this->pageTitle4->getPrefixedText()
199 $this->
assertRevision( $this->revId4_1,
"Talk BackupDumperTestP1 Summary1",
200 $this->textId4_1, 35,
"nktofwzd0tl192k3zfepmlzxoax1lpe" );
212 $dumper->endId = $this->pageId4 + 1;
213 $dumper->reporting =
false;
214 $dumper->setDB( $this->db );
223 $this->
assertPageStart( $this->pageId1, $this->
namespace, $this->pageTitle1->getPrefixedText() );
224 $this->
assertRevision( $this->revId1_1,
"BackupDumperTestP1Summary1",
225 $this->textId1_1, 23,
"0bolhl6ol7i6x0e7yq91gxgaan39j87" );
229 $this->
assertPageStart( $this->pageId2, $this->
namespace, $this->pageTitle2->getPrefixedText() );
230 $this->
assertRevision( $this->revId2_4,
"BackupDumperTestP2Summary4 extra",
231 $this->textId2_4, 44,
"6o1ciaxa6pybnqprmungwofc4lv00wv",
false, $this->revId2_3 );
240 $this->talk_namespace,
241 $this->pageTitle4->getPrefixedText()
243 $this->
assertRevision( $this->revId4_1,
"Talk BackupDumperTestP1 Summary1",
244 $this->textId4_1, 35,
"nktofwzd0tl192k3zfepmlzxoax1lpe" );
258 $dumper->endId = $this->pageId4 + 1;
259 $dumper->reporting =
false;
260 $dumper->setDB( $this->db );
270 $this->
assertPageStart( $this->pageId1, $this->
namespace, $this->pageTitle1->getPrefixedText() );
271 $this->
assertRevision( $this->revId1_1,
"BackupDumperTestP1Summary1",
272 $this->textId1_1, 23,
"0bolhl6ol7i6x0e7yq91gxgaan39j87" );
276 $this->
assertPageStart( $this->pageId2, $this->
namespace, $this->pageTitle2->getPrefixedText() );
277 $this->
assertRevision( $this->revId2_4,
"BackupDumperTestP2Summary4 extra",
278 $this->textId2_4, 44,
"6o1ciaxa6pybnqprmungwofc4lv00wv",
false, $this->revId2_3 );
287 $this->talk_namespace,
288 $this->pageTitle4->getPrefixedText()
290 $this->
assertRevision( $this->revId4_1,
"Talk BackupDumperTestP1 Summary1",
291 $this->textId4_1, 35,
"nktofwzd0tl192k3zfepmlzxoax1lpe" );
315 $dumper =
new DumpBackup( [
"--full",
"--stub",
"--output=gzip:" . $fnameMetaHistory,
316 "--output=gzip:" . $fnameMetaCurrent,
"--filter=latest",
317 "--output=gzip:" . $fnameArticles,
"--filter=latest",
318 "--filter=notalk",
"--filter=namespace:!NS_USER",
319 "--reporting=1000" ] );
321 $dumper->endId = $this->pageId4 + 1;
322 $dumper->setDB( $this->db );
328 $dumper->stderr = fopen(
'php://output',
'a' );
329 if ( $dumper->stderr ===
false ) {
330 $this->fail(
"Could not open stream for stderr" );
336 $this->assertTrue( fclose( $dumper->stderr ),
"Closing stderr handle" );
340 $this->
gunzip( $fnameMetaHistory );
344 $this->
assertPageStart( $this->pageId1, $this->
namespace, $this->pageTitle1->getPrefixedText() );
345 $this->
assertRevision( $this->revId1_1,
"BackupDumperTestP1Summary1",
346 $this->textId1_1, 23,
"0bolhl6ol7i6x0e7yq91gxgaan39j87" );
350 $this->
assertPageStart( $this->pageId2, $this->
namespace, $this->pageTitle2->getPrefixedText() );
351 $this->
assertRevision( $this->revId2_1,
"BackupDumperTestP2Summary1",
352 $this->textId2_1, 23,
"jprywrymfhysqllua29tj3sc7z39dl2" );
353 $this->
assertRevision( $this->revId2_2,
"BackupDumperTestP2Summary2",
354 $this->textId2_2, 23,
"b7vj5ks32po5m1z1t1br4o7scdwwy95",
false, $this->revId2_1 );
355 $this->
assertRevision( $this->revId2_3,
"BackupDumperTestP2Summary3",
356 $this->textId2_3, 23,
"jfunqmh1ssfb8rs43r19w98k28gg56r",
false, $this->revId2_2 );
357 $this->
assertRevision( $this->revId2_4,
"BackupDumperTestP2Summary4 extra",
358 $this->textId2_4, 44,
"6o1ciaxa6pybnqprmungwofc4lv00wv",
false, $this->revId2_3 );
367 $this->talk_namespace,
368 $this->pageTitle4->getPrefixedText()
370 $this->
assertRevision( $this->revId4_1,
"Talk BackupDumperTestP1 Summary1",
371 $this->textId4_1, 35,
"nktofwzd0tl192k3zfepmlzxoax1lpe" );
378 $this->
gunzip( $fnameMetaCurrent );
382 $this->
assertPageStart( $this->pageId1, $this->
namespace, $this->pageTitle1->getPrefixedText() );
383 $this->
assertRevision( $this->revId1_1,
"BackupDumperTestP1Summary1",
384 $this->textId1_1, 23,
"0bolhl6ol7i6x0e7yq91gxgaan39j87" );
388 $this->
assertPageStart( $this->pageId2, $this->
namespace, $this->pageTitle2->getPrefixedText() );
389 $this->
assertRevision( $this->revId2_4,
"BackupDumperTestP2Summary4 extra",
390 $this->textId2_4, 44,
"6o1ciaxa6pybnqprmungwofc4lv00wv",
false, $this->revId2_3 );
399 $this->talk_namespace,
400 $this->pageTitle4->getPrefixedText()
402 $this->
assertRevision( $this->revId4_1,
"Talk BackupDumperTestP1 Summary1",
403 $this->textId4_1, 35,
"nktofwzd0tl192k3zfepmlzxoax1lpe" );
410 $this->
gunzip( $fnameArticles );
414 $this->
assertPageStart( $this->pageId1, $this->
namespace, $this->pageTitle1->getPrefixedText() );
415 $this->
assertRevision( $this->revId1_1,
"BackupDumperTestP1Summary1",
416 $this->textId1_1, 23,
"0bolhl6ol7i6x0e7yq91gxgaan39j87" );
420 $this->
assertPageStart( $this->pageId2, $this->
namespace, $this->pageTitle2->getPrefixedText() );
421 $this->
assertRevision( $this->revId2_4,
"BackupDumperTestP2Summary4 extra",
422 $this->textId2_4, 44,
"6o1ciaxa6pybnqprmungwofc4lv00wv",
false, $this->revId2_3 );