5 * @subpackage Maintenance
10 * php dumpHTML.php [options...]
12 * -d <dest> destination directory
15 * --images only do image description pages
16 * --categories only do category pages
17 * --special only do miscellaneous stuff
18 * --force-copy copy commons instead of symlink, needed for Wikimedia
19 * --interlang allow interlanguage links
23 $optionsWithArgs = array( 's', 'd', 'e' );
25 require_once( "commandLine.inc" );
26 require_once( "dumpHTML.inc" );
28 error_reporting( E_ALL
& (~E_NOTICE
) );
29 define( 'CHUNK_SIZE', 50 );
31 if ( !empty( $options['s'] ) ) {
32 $start = $options['s'];
37 if ( !empty( $options['e'] ) ) {
40 $dbr =& wfGetDB( DB_SLAVE
);
41 $end = $dbr->selectField( 'page', 'max(page_id)', false );
44 if ( !empty( $options['d'] ) ) {
45 $dest = $options['d'];
50 $d = new DumpHTML( array(
52 'forceCopy' => $options['force-copy'],
53 'alternateScriptPath' => $options['interlang'],
54 'interwiki' => $options['interlang'],
58 if ( $options['special'] ) {
60 } elseif ( $options['images'] ) {
61 $d->doImageDescriptions();
62 } elseif ( $options['categories'] ) {
65 print("Creating static HTML dump in directory $dest. \n".
66 "Starting from page_id $start of $end.\n");
67 $d->doArticles( $start, $end );
68 $d->doImageDescriptions();
73 if ( $end - $start > CHUNK_SIZE * 2 ) {
74 // Split the problem into smaller chunks, run them in different PHP instances
75 // This is a memory/resource leak workaround
76 print("Creating static HTML dump in directory $dest. \n".
77 "Starting from page_id $start of $end.\n");
79 chdir( "maintenance" );
80 for ( $chunkStart = $start; $chunkStart < $end; $chunkStart += CHUNK_SIZE ) {
81 $chunkEnd = $chunkStart + CHUNK_SIZE - 1;
82 if ( $chunkEnd > $end ) {
85 passthru( "php dumpHTML.php -d " . wfEscapeShellArg( $dest ) . " -s $chunkStart -e $chunkEnd" );
88 $d->doImageDescriptions();
90 $d->doMainPage( $dest );
92 $d->doArticles( $start, $end );