34 $this->tablesUsed[] =
'page';
35 $this->tablesUsed[] =
'revision';
36 $this->tablesUsed[] =
'ip_changes';
37 $this->tablesUsed[] =
'text';
41 $this->talk_namespace =
NS_TALK;
43 if ( $this->
namespace === $this->talk_namespace ) {
45 throw new MWException(
"The default wikitext namespace is the talk namespace. "
46 .
" We can't currently deal with that." );
52 "BackupDumperTestP1Text1",
"BackupDumperTestP1Summary1" );
53 $this->pageId1 = $page->getId();
58 "BackupDumperTestP2Text1",
"BackupDumperTestP2Summary1" );
60 "BackupDumperTestP2Text2",
"BackupDumperTestP2Summary2" );
62 "BackupDumperTestP2Text3",
"BackupDumperTestP2Summary3" );
64 "BackupDumperTestP2Text4 some additional Text ",
65 "BackupDumperTestP2Summary4 extra " );
66 $this->pageId2 = $page->getId();
71 "BackupDumperTestP3Text1",
"BackupDumperTestP2Summary1" );
73 "BackupDumperTestP3Text2",
"BackupDumperTestP2Summary2" );
74 $this->pageId3 = $page->getId();
75 $page->doDeleteArticle(
"Testing ;)" );
80 "Talk about BackupDumperTestP1 Text1",
81 "Talk BackupDumperTestP1 Summary1" );
82 $this->pageId4 = $page->getId();
83 }
catch ( Exception
$e ) {
87 $this->exceptionFromAddDBData =
$e;
99 [ $this->pageId2, $this->pageId3, $this->pageId4 ],
100 [ $this->pageId1 + 1, $this->pageId2 + 1, $this->pageId3 + 1 ],
101 "Page ids increasing without holes" );
109 $dumper->loadWithArgv( [
'--full',
'--quiet',
'--output',
'file:' .
$fname ] );
111 $dumper->endId = $this->pageId4 + 1;
112 $dumper->setDB( $this->db );
121 $this->
assertPageStart( $this->pageId1, $this->
namespace, $this->pageTitle1->getPrefixedText() );
122 $this->
assertRevision( $this->revId1_1,
"BackupDumperTestP1Summary1",
123 $this->textId1_1, 23,
"0bolhl6ol7i6x0e7yq91gxgaan39j87",
124 "BackupDumperTestP1Text1" );
128 $this->
assertPageStart( $this->pageId2, $this->
namespace, $this->pageTitle2->getPrefixedText() );
129 $this->
assertRevision( $this->revId2_1,
"BackupDumperTestP2Summary1",
130 $this->textId2_1, 23,
"jprywrymfhysqllua29tj3sc7z39dl2",
131 "BackupDumperTestP2Text1" );
132 $this->
assertRevision( $this->revId2_2,
"BackupDumperTestP2Summary2",
133 $this->textId2_2, 23,
"b7vj5ks32po5m1z1t1br4o7scdwwy95",
134 "BackupDumperTestP2Text2", $this->revId2_1 );
135 $this->
assertRevision( $this->revId2_3,
"BackupDumperTestP2Summary3",
136 $this->textId2_3, 23,
"jfunqmh1ssfb8rs43r19w98k28gg56r",
137 "BackupDumperTestP2Text3", $this->revId2_2 );
138 $this->
assertRevision( $this->revId2_4,
"BackupDumperTestP2Summary4 extra",
139 $this->textId2_4, 44,
"6o1ciaxa6pybnqprmungwofc4lv00wv",
140 "BackupDumperTestP2Text4 some additional Text", $this->revId2_3 );
149 $this->talk_namespace,
150 $this->pageTitle4->getPrefixedText()
152 $this->
assertRevision( $this->revId4_1,
"Talk BackupDumperTestP1 Summary1",
153 $this->textId4_1, 35,
"nktofwzd0tl192k3zfepmlzxoax1lpe",
154 "Talk about BackupDumperTestP1 Text1" );
165 $dumper->loadWithArgv( [
'--full',
'--quiet',
'--output',
'file:' .
$fname,
'--stub' ] );
167 $dumper->endId = $this->pageId4 + 1;
168 $dumper->setDB( $this->db );
177 $this->
assertPageStart( $this->pageId1, $this->
namespace, $this->pageTitle1->getPrefixedText() );
178 $this->
assertRevision( $this->revId1_1,
"BackupDumperTestP1Summary1",
179 $this->textId1_1, 23,
"0bolhl6ol7i6x0e7yq91gxgaan39j87" );
183 $this->
assertPageStart( $this->pageId2, $this->
namespace, $this->pageTitle2->getPrefixedText() );
184 $this->
assertRevision( $this->revId2_1,
"BackupDumperTestP2Summary1",
185 $this->textId2_1, 23,
"jprywrymfhysqllua29tj3sc7z39dl2" );
186 $this->
assertRevision( $this->revId2_2,
"BackupDumperTestP2Summary2",
187 $this->textId2_2, 23,
"b7vj5ks32po5m1z1t1br4o7scdwwy95",
false, $this->revId2_1 );
188 $this->
assertRevision( $this->revId2_3,
"BackupDumperTestP2Summary3",
189 $this->textId2_3, 23,
"jfunqmh1ssfb8rs43r19w98k28gg56r",
false, $this->revId2_2 );
190 $this->
assertRevision( $this->revId2_4,
"BackupDumperTestP2Summary4 extra",
191 $this->textId2_4, 44,
"6o1ciaxa6pybnqprmungwofc4lv00wv",
false, $this->revId2_3 );
200 $this->talk_namespace,
201 $this->pageTitle4->getPrefixedText()
203 $this->
assertRevision( $this->revId4_1,
"Talk BackupDumperTestP1 Summary1",
204 $this->textId4_1, 35,
"nktofwzd0tl192k3zfepmlzxoax1lpe" );
216 $dumper->endId = $this->pageId4 + 1;
217 $dumper->reporting =
false;
218 $dumper->setDB( $this->db );
227 $this->
assertPageStart( $this->pageId1, $this->
namespace, $this->pageTitle1->getPrefixedText() );
228 $this->
assertRevision( $this->revId1_1,
"BackupDumperTestP1Summary1",
229 $this->textId1_1, 23,
"0bolhl6ol7i6x0e7yq91gxgaan39j87" );
233 $this->
assertPageStart( $this->pageId2, $this->
namespace, $this->pageTitle2->getPrefixedText() );
234 $this->
assertRevision( $this->revId2_4,
"BackupDumperTestP2Summary4 extra",
235 $this->textId2_4, 44,
"6o1ciaxa6pybnqprmungwofc4lv00wv",
false, $this->revId2_3 );
244 $this->talk_namespace,
245 $this->pageTitle4->getPrefixedText()
247 $this->
assertRevision( $this->revId4_1,
"Talk BackupDumperTestP1 Summary1",
248 $this->textId4_1, 35,
"nktofwzd0tl192k3zfepmlzxoax1lpe" );
262 $dumper->endId = $this->pageId4 + 1;
263 $dumper->reporting =
false;
264 $dumper->setDB( $this->db );
274 $this->
assertPageStart( $this->pageId1, $this->
namespace, $this->pageTitle1->getPrefixedText() );
275 $this->
assertRevision( $this->revId1_1,
"BackupDumperTestP1Summary1",
276 $this->textId1_1, 23,
"0bolhl6ol7i6x0e7yq91gxgaan39j87" );
280 $this->
assertPageStart( $this->pageId2, $this->
namespace, $this->pageTitle2->getPrefixedText() );
281 $this->
assertRevision( $this->revId2_4,
"BackupDumperTestP2Summary4 extra",
282 $this->textId2_4, 44,
"6o1ciaxa6pybnqprmungwofc4lv00wv",
false, $this->revId2_3 );
291 $this->talk_namespace,
292 $this->pageTitle4->getPrefixedText()
294 $this->
assertRevision( $this->revId4_1,
"Talk BackupDumperTestP1 Summary1",
295 $this->textId4_1, 35,
"nktofwzd0tl192k3zfepmlzxoax1lpe" );
319 $dumper =
new DumpBackup( [
"--full",
"--stub",
"--output=gzip:" . $fnameMetaHistory,
320 "--output=gzip:" . $fnameMetaCurrent,
"--filter=latest",
321 "--output=gzip:" . $fnameArticles,
"--filter=latest",
322 "--filter=notalk",
"--filter=namespace:!NS_USER",
323 "--reporting=1000" ] );
325 $dumper->endId = $this->pageId4 + 1;
326 $dumper->setDB( $this->db );
332 $dumper->stderr = fopen(
'php://output',
'a' );
333 if ( $dumper->stderr ===
false ) {
334 $this->fail(
"Could not open stream for stderr" );
340 $this->assertTrue( fclose( $dumper->stderr ),
"Closing stderr handle" );
344 $this->
gunzip( $fnameMetaHistory );
348 $this->
assertPageStart( $this->pageId1, $this->
namespace, $this->pageTitle1->getPrefixedText() );
349 $this->
assertRevision( $this->revId1_1,
"BackupDumperTestP1Summary1",
350 $this->textId1_1, 23,
"0bolhl6ol7i6x0e7yq91gxgaan39j87" );
354 $this->
assertPageStart( $this->pageId2, $this->
namespace, $this->pageTitle2->getPrefixedText() );
355 $this->
assertRevision( $this->revId2_1,
"BackupDumperTestP2Summary1",
356 $this->textId2_1, 23,
"jprywrymfhysqllua29tj3sc7z39dl2" );
357 $this->
assertRevision( $this->revId2_2,
"BackupDumperTestP2Summary2",
358 $this->textId2_2, 23,
"b7vj5ks32po5m1z1t1br4o7scdwwy95",
false, $this->revId2_1 );
359 $this->
assertRevision( $this->revId2_3,
"BackupDumperTestP2Summary3",
360 $this->textId2_3, 23,
"jfunqmh1ssfb8rs43r19w98k28gg56r",
false, $this->revId2_2 );
361 $this->
assertRevision( $this->revId2_4,
"BackupDumperTestP2Summary4 extra",
362 $this->textId2_4, 44,
"6o1ciaxa6pybnqprmungwofc4lv00wv",
false, $this->revId2_3 );
371 $this->talk_namespace,
372 $this->pageTitle4->getPrefixedText()
374 $this->
assertRevision( $this->revId4_1,
"Talk BackupDumperTestP1 Summary1",
375 $this->textId4_1, 35,
"nktofwzd0tl192k3zfepmlzxoax1lpe" );
382 $this->
gunzip( $fnameMetaCurrent );
386 $this->
assertPageStart( $this->pageId1, $this->
namespace, $this->pageTitle1->getPrefixedText() );
387 $this->
assertRevision( $this->revId1_1,
"BackupDumperTestP1Summary1",
388 $this->textId1_1, 23,
"0bolhl6ol7i6x0e7yq91gxgaan39j87" );
392 $this->
assertPageStart( $this->pageId2, $this->
namespace, $this->pageTitle2->getPrefixedText() );
393 $this->
assertRevision( $this->revId2_4,
"BackupDumperTestP2Summary4 extra",
394 $this->textId2_4, 44,
"6o1ciaxa6pybnqprmungwofc4lv00wv",
false, $this->revId2_3 );
403 $this->talk_namespace,
404 $this->pageTitle4->getPrefixedText()
406 $this->
assertRevision( $this->revId4_1,
"Talk BackupDumperTestP1 Summary1",
407 $this->textId4_1, 35,
"nktofwzd0tl192k3zfepmlzxoax1lpe" );
414 $this->
gunzip( $fnameArticles );
418 $this->
assertPageStart( $this->pageId1, $this->
namespace, $this->pageTitle1->getPrefixedText() );
419 $this->
assertRevision( $this->revId1_1,
"BackupDumperTestP1Summary1",
420 $this->textId1_1, 23,
"0bolhl6ol7i6x0e7yq91gxgaan39j87" );
424 $this->
assertPageStart( $this->pageId2, $this->
namespace, $this->pageTitle2->getPrefixedText() );
425 $this->
assertRevision( $this->revId2_4,
"BackupDumperTestP2Summary4 extra",
426 $this->textId2_4, 44,
"6o1ciaxa6pybnqprmungwofc4lv00wv",
false, $this->revId2_3 );