Now use parserTests diff engine when an entry in the reference file given differs...
[lhc/web/wiklou.git] / maintenance / dumpHTML.php
1 <?php
2 /**
3 * @todo document
4 * @package MediaWiki
5 * @subpackage Maintenance
6 */
7
8 /** */
9
10 $optionsWithArgs = array( 's', 'd', 'e' );
11
12 require_once( "commandLine.inc" );
13 require_once( "dumpHTML.inc" );
14
15 error_reporting( E_ALL & (~E_NOTICE) );
16 define( 'CHUNK_SIZE', 50 );
17
18 if ( !empty( $options['s'] ) ) {
19 $start = $options['s'];
20 } else {
21 $start = 1;
22 }
23
24 if ( !empty( $options['e'] ) ) {
25 $end = $options['e'];
26 } else {
27 $dbr =& wfGetDB( DB_SLAVE );
28 $end = $dbr->selectField( 'page', 'max(page_id)', false );
29 }
30
31 if ( !empty( $options['d'] ) ) {
32 $dest = $options['d'];
33 } else {
34 $dest = 'static';
35 }
36
37 $d = new DumpHTML( $dest, true, 3 );
38
39 if ( $options['special'] ) {
40 $d->doSpecials();
41 } elseif ( $options['images'] ) {
42 $d->doImageDescriptions();
43 } elseif ( $options['categories'] ) {
44 $d->doCategories();
45 } else {
46 if ( $end - $start > CHUNK_SIZE * 2 ) {
47 // Split the problem into smaller chunks, run them in different PHP instances
48 // This is a memory/resource leak workaround
49 print("Creating static HTML dump. Starting from page_id $start of $end.\n");
50 chdir( "maintenance" );
51 for ( $chunkStart = $start; $chunkStart < $end; $chunkStart += CHUNK_SIZE ) {
52 $chunkEnd = $chunkStart + CHUNK_SIZE - 1;
53 if ( $chunkEnd > $end ) {
54 $chunkEnd = $end;
55 }
56 passthru( "php dumpHTML.php -s $chunkStart -e $chunkEnd" );
57 }
58 chdir( ".." );
59 $d->doImageDescriptions();
60 $d->doCategories();
61 $d->doMainPage( $dest );
62 } else {
63 $d->doArticles( $start, $end );
64 }
65 }
66
67 exit();
68
69 ?>