5 * @subpackage Maintenance
10 $optionsWithArgs = array( 's', 'd', 'e' );
12 require_once( "commandLine.inc" );
13 require_once( "dumpHTML.inc" );
15 error_reporting( E_ALL
& (~E_NOTICE
) );
16 define( 'CHUNK_SIZE', 50 );
18 if ( !empty( $options['s'] ) ) {
19 $start = $options['s'];
24 if ( !empty( $options['e'] ) ) {
27 $dbr =& wfGetDB( DB_SLAVE
);
28 $end = $dbr->selectField( 'page', 'max(page_id)', false );
31 if ( !empty( $options['d'] ) ) {
32 $dest = $options['d'];
37 $d = new DumpHTML( $dest, true, 3 );
39 if ( $options['special'] ) {
41 } elseif ( $options['images'] ) {
42 $d->doImageDescriptions();
43 } elseif ( $options['categories'] ) {
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 ) {
56 passthru( "php dumpHTML.php -s $chunkStart -e $chunkEnd" );
59 $d->doImageDescriptions();
61 $d->doMainPage( $dest );
63 $d->doArticles( $start, $end );