26 'wgLanguageCode' =>
'en',
30 $this->tablesUsed[] =
'page';
31 $this->tablesUsed[] =
'revision';
32 $this->tablesUsed[] =
'text';
36 $this->talk_namespace =
NS_TALK;
38 if ( $this->
namespace === $this->talk_namespace ) {
40 throw new MWException(
"The default wikitext namespace is the talk namespace. "
41 .
" We can't currently deal with that." );
47 "BackupDumperTestP1Text1",
"BackupDumperTestP1Summary1" );
48 $this->pageId1 =
$page->getId();
53 "BackupDumperTestP2Text1",
"BackupDumperTestP2Summary1" );
55 "BackupDumperTestP2Text2",
"BackupDumperTestP2Summary2" );
57 "BackupDumperTestP2Text3",
"BackupDumperTestP2Summary3" );
59 "BackupDumperTestP2Text4 some additional Text ",
60 "BackupDumperTestP2Summary4 extra " );
61 $this->pageId2 =
$page->getId();
66 "BackupDumperTestP3Text1",
"BackupDumperTestP2Summary1" );
68 "BackupDumperTestP3Text2",
"BackupDumperTestP2Summary2" );
69 $this->pageId3 =
$page->getId();
70 $page->doDeleteArticle(
"Testing ;)" );
75 "Talk about BackupDumperTestP1 Text1",
76 "Talk BackupDumperTestP1 Summary1" );
77 $this->pageId4 =
$page->getId();
78 }
catch ( Exception
$e ) {
82 $this->exceptionFromAddDBData =
$e;
94 [ $this->pageId2, $this->pageId3, $this->pageId4 ],
95 [ $this->pageId1 + 1, $this->pageId2 + 1, $this->pageId3 + 1 ],
96 "Page ids increasing without holes" );
104 $dumper->loadWithArgv( [
'--full',
'--quiet',
'--output',
'file:' .
$fname ] );
106 $dumper->endId = $this->pageId4 + 1;
107 $dumper->setDB( $this->db );
116 $this->
assertPageStart( $this->pageId1, $this->
namespace, $this->pageTitle1->getPrefixedText() );
117 $this->
assertRevision( $this->revId1_1,
"BackupDumperTestP1Summary1",
118 $this->textId1_1, 23,
"0bolhl6ol7i6x0e7yq91gxgaan39j87",
119 "BackupDumperTestP1Text1" );
123 $this->
assertPageStart( $this->pageId2, $this->
namespace, $this->pageTitle2->getPrefixedText() );
124 $this->
assertRevision( $this->revId2_1,
"BackupDumperTestP2Summary1",
125 $this->textId2_1, 23,
"jprywrymfhysqllua29tj3sc7z39dl2",
126 "BackupDumperTestP2Text1" );
127 $this->
assertRevision( $this->revId2_2,
"BackupDumperTestP2Summary2",
128 $this->textId2_2, 23,
"b7vj5ks32po5m1z1t1br4o7scdwwy95",
129 "BackupDumperTestP2Text2", $this->revId2_1 );
130 $this->
assertRevision( $this->revId2_3,
"BackupDumperTestP2Summary3",
131 $this->textId2_3, 23,
"jfunqmh1ssfb8rs43r19w98k28gg56r",
132 "BackupDumperTestP2Text3", $this->revId2_2 );
133 $this->
assertRevision( $this->revId2_4,
"BackupDumperTestP2Summary4 extra",
134 $this->textId2_4, 44,
"6o1ciaxa6pybnqprmungwofc4lv00wv",
135 "BackupDumperTestP2Text4 some additional Text", $this->revId2_3 );
144 $this->talk_namespace,
145 $this->pageTitle4->getPrefixedText()
147 $this->
assertRevision( $this->revId4_1,
"Talk BackupDumperTestP1 Summary1",
148 $this->textId4_1, 35,
"nktofwzd0tl192k3zfepmlzxoax1lpe",
149 "Talk about BackupDumperTestP1 Text1" );
160 $dumper->loadWithArgv( [
'--full',
'--quiet',
'--output',
'file:' .
$fname,
'--stub' ] );
162 $dumper->endId = $this->pageId4 + 1;
163 $dumper->setDB( $this->db );
172 $this->
assertPageStart( $this->pageId1, $this->
namespace, $this->pageTitle1->getPrefixedText() );
173 $this->
assertRevision( $this->revId1_1,
"BackupDumperTestP1Summary1",
174 $this->textId1_1, 23,
"0bolhl6ol7i6x0e7yq91gxgaan39j87" );
178 $this->
assertPageStart( $this->pageId2, $this->
namespace, $this->pageTitle2->getPrefixedText() );
179 $this->
assertRevision( $this->revId2_1,
"BackupDumperTestP2Summary1",
180 $this->textId2_1, 23,
"jprywrymfhysqllua29tj3sc7z39dl2" );
181 $this->
assertRevision( $this->revId2_2,
"BackupDumperTestP2Summary2",
182 $this->textId2_2, 23,
"b7vj5ks32po5m1z1t1br4o7scdwwy95",
false, $this->revId2_1 );
183 $this->
assertRevision( $this->revId2_3,
"BackupDumperTestP2Summary3",
184 $this->textId2_3, 23,
"jfunqmh1ssfb8rs43r19w98k28gg56r",
false, $this->revId2_2 );
185 $this->
assertRevision( $this->revId2_4,
"BackupDumperTestP2Summary4 extra",
186 $this->textId2_4, 44,
"6o1ciaxa6pybnqprmungwofc4lv00wv",
false, $this->revId2_3 );
195 $this->talk_namespace,
196 $this->pageTitle4->getPrefixedText()
198 $this->
assertRevision( $this->revId4_1,
"Talk BackupDumperTestP1 Summary1",
199 $this->textId4_1, 35,
"nktofwzd0tl192k3zfepmlzxoax1lpe" );
211 $dumper->endId = $this->pageId4 + 1;
212 $dumper->reporting =
false;
213 $dumper->setDB( $this->db );
222 $this->
assertPageStart( $this->pageId1, $this->
namespace, $this->pageTitle1->getPrefixedText() );
223 $this->
assertRevision( $this->revId1_1,
"BackupDumperTestP1Summary1",
224 $this->textId1_1, 23,
"0bolhl6ol7i6x0e7yq91gxgaan39j87" );
228 $this->
assertPageStart( $this->pageId2, $this->
namespace, $this->pageTitle2->getPrefixedText() );
229 $this->
assertRevision( $this->revId2_4,
"BackupDumperTestP2Summary4 extra",
230 $this->textId2_4, 44,
"6o1ciaxa6pybnqprmungwofc4lv00wv",
false, $this->revId2_3 );
239 $this->talk_namespace,
240 $this->pageTitle4->getPrefixedText()
242 $this->
assertRevision( $this->revId4_1,
"Talk BackupDumperTestP1 Summary1",
243 $this->textId4_1, 35,
"nktofwzd0tl192k3zfepmlzxoax1lpe" );
257 $dumper->endId = $this->pageId4 + 1;
258 $dumper->reporting =
false;
259 $dumper->setDB( $this->db );
269 $this->
assertPageStart( $this->pageId1, $this->
namespace, $this->pageTitle1->getPrefixedText() );
270 $this->
assertRevision( $this->revId1_1,
"BackupDumperTestP1Summary1",
271 $this->textId1_1, 23,
"0bolhl6ol7i6x0e7yq91gxgaan39j87" );
275 $this->
assertPageStart( $this->pageId2, $this->
namespace, $this->pageTitle2->getPrefixedText() );
276 $this->
assertRevision( $this->revId2_4,
"BackupDumperTestP2Summary4 extra",
277 $this->textId2_4, 44,
"6o1ciaxa6pybnqprmungwofc4lv00wv",
false, $this->revId2_3 );
286 $this->talk_namespace,
287 $this->pageTitle4->getPrefixedText()
289 $this->
assertRevision( $this->revId4_1,
"Talk BackupDumperTestP1 Summary1",
290 $this->textId4_1, 35,
"nktofwzd0tl192k3zfepmlzxoax1lpe" );
314 $dumper =
new DumpBackup( [
"--full",
"--stub",
"--output=gzip:" . $fnameMetaHistory,
315 "--output=gzip:" . $fnameMetaCurrent,
"--filter=latest",
316 "--output=gzip:" . $fnameArticles,
"--filter=latest",
317 "--filter=notalk",
"--filter=namespace:!NS_USER",
318 "--reporting=1000" ] );
320 $dumper->endId = $this->pageId4 + 1;
321 $dumper->setDB( $this->db );
327 $dumper->stderr = fopen(
'php://output',
'a' );
328 if ( $dumper->stderr ===
false ) {
329 $this->fail(
"Could not open stream for stderr" );
335 $this->assertTrue( fclose( $dumper->stderr ),
"Closing stderr handle" );
339 $this->
gunzip( $fnameMetaHistory );
343 $this->
assertPageStart( $this->pageId1, $this->
namespace, $this->pageTitle1->getPrefixedText() );
344 $this->
assertRevision( $this->revId1_1,
"BackupDumperTestP1Summary1",
345 $this->textId1_1, 23,
"0bolhl6ol7i6x0e7yq91gxgaan39j87" );
349 $this->
assertPageStart( $this->pageId2, $this->
namespace, $this->pageTitle2->getPrefixedText() );
350 $this->
assertRevision( $this->revId2_1,
"BackupDumperTestP2Summary1",
351 $this->textId2_1, 23,
"jprywrymfhysqllua29tj3sc7z39dl2" );
352 $this->
assertRevision( $this->revId2_2,
"BackupDumperTestP2Summary2",
353 $this->textId2_2, 23,
"b7vj5ks32po5m1z1t1br4o7scdwwy95",
false, $this->revId2_1 );
354 $this->
assertRevision( $this->revId2_3,
"BackupDumperTestP2Summary3",
355 $this->textId2_3, 23,
"jfunqmh1ssfb8rs43r19w98k28gg56r",
false, $this->revId2_2 );
356 $this->
assertRevision( $this->revId2_4,
"BackupDumperTestP2Summary4 extra",
357 $this->textId2_4, 44,
"6o1ciaxa6pybnqprmungwofc4lv00wv",
false, $this->revId2_3 );
366 $this->talk_namespace,
367 $this->pageTitle4->getPrefixedText()
369 $this->
assertRevision( $this->revId4_1,
"Talk BackupDumperTestP1 Summary1",
370 $this->textId4_1, 35,
"nktofwzd0tl192k3zfepmlzxoax1lpe" );
377 $this->
gunzip( $fnameMetaCurrent );
381 $this->
assertPageStart( $this->pageId1, $this->
namespace, $this->pageTitle1->getPrefixedText() );
382 $this->
assertRevision( $this->revId1_1,
"BackupDumperTestP1Summary1",
383 $this->textId1_1, 23,
"0bolhl6ol7i6x0e7yq91gxgaan39j87" );
387 $this->
assertPageStart( $this->pageId2, $this->
namespace, $this->pageTitle2->getPrefixedText() );
388 $this->
assertRevision( $this->revId2_4,
"BackupDumperTestP2Summary4 extra",
389 $this->textId2_4, 44,
"6o1ciaxa6pybnqprmungwofc4lv00wv",
false, $this->revId2_3 );
398 $this->talk_namespace,
399 $this->pageTitle4->getPrefixedText()
401 $this->
assertRevision( $this->revId4_1,
"Talk BackupDumperTestP1 Summary1",
402 $this->textId4_1, 35,
"nktofwzd0tl192k3zfepmlzxoax1lpe" );
409 $this->
gunzip( $fnameArticles );
413 $this->
assertPageStart( $this->pageId1, $this->
namespace, $this->pageTitle1->getPrefixedText() );
414 $this->
assertRevision( $this->revId1_1,
"BackupDumperTestP1Summary1",
415 $this->textId1_1, 23,
"0bolhl6ol7i6x0e7yq91gxgaan39j87" );
419 $this->
assertPageStart( $this->pageId2, $this->
namespace, $this->pageTitle2->getPrefixedText() );
420 $this->
assertRevision( $this->revId2_4,
"BackupDumperTestP2Summary4 extra",
421 $this->textId2_4, 44,
"6o1ciaxa6pybnqprmungwofc4lv00wv",
false, $this->revId2_3 );