4 * @addtogroup Maintenance
10 php dumpHTML.php --help
11 php dumpHTML.php [options...]
13 --help show this message
15 -d <dest> destination directory
18 -k <skin> skin to use (defaults to htmldump)
19 --no-overwrite skip existing HTML files
20 --checkpoint <file> use a checkpoint file to allow restarting of interrupted dumps
21 --slice <n/m> split the job into m segments and do the n'th one
22 --images only do image description pages
23 --shared-desc only do shared (commons) image description pages
24 --no-shared-desc don't do shared image description pages
25 --categories only do category pages
26 --redirects only do redirects
27 --special only do miscellaneous stuff
28 --force-copy copy commons instead of symlink, needed for Wikimedia
29 --interlang allow interlanguage links
30 --image-snapshot copy all images used to the destination directory
31 --compress generate compressed version of the html pages
32 --udp-profile <N> profile 1/N rendering operations using ProfilerSimpleUDP
37 $optionsWithArgs = array( 's', 'd', 'e', 'k', 'checkpoint', 'slice', 'udp-profile' );
38 $options = array( 'help' );
42 define( 'MW_CMDLINE_CALLBACK', 'wfSetupDump' );
43 function wfSetupDump() {
44 global $wgProfiling, $wgProfileToDatabase, $wgProfileSampleRate;
46 $wgProfileToDatabase = false;
47 $wgProfileSampleRate = 1;
51 if ( in_array( '--udp-profile', $argv ) ) {
52 define( 'MW_FORCE_PROFILE', 1 );
55 require_once( "commandLine.inc" );
56 require_once( "dumpHTML.inc" );
58 error_reporting( E_ALL
& (~E_NOTICE
) );
60 if( isset( $options['help'] ) ) {
65 if ( !empty( $options['s'] ) ) {
66 $start = $options['s'];
71 if ( !empty( $options['e'] ) ) {
74 $dbr = wfGetDB( DB_SLAVE
);
75 $end = $dbr->selectField( 'page', 'max(page_id)', false );
78 if ( !empty( $options['d'] ) ) {
79 $dest = $options['d'];
84 $skin = isset( $options['k'] ) ?
$options['k'] : 'htmldump';
86 if ( $options['slice'] ) {
87 $bits = explode( '/', $options['slice'] );
88 if ( count( $bits ) != 2 ||
$bits[0] < 1 ||
$bits[0] > $bits[1] ) {
89 print "Invalid slice specification";
92 $sliceNumerator = $bits[0];
93 $sliceDenominator = $bits[1];
95 $sliceNumerator = $sliceDenominator = 1;
98 $wgHTMLDump = new DumpHTML( array(
100 'forceCopy' => $options['force-copy'],
101 'alternateScriptPath' => $options['interlang'],
102 'interwiki' => $options['interlang'],
104 'makeSnapshot' => $options['image-snapshot'],
105 'checkpointFile' => $options['checkpoint'],
108 'sliceNumerator' => $sliceNumerator,
109 'sliceDenominator' => $sliceDenominator,
110 'noOverwrite' => $options['no-overwrite'],
111 'compress' => $options['compress'],
112 'noSharedDesc' => $options['no-shared-desc'],
113 'udpProfile' => $options['udp-profile'],
117 if ( $options['special'] ) {
118 $wgHTMLDump->doSpecials();
119 } elseif ( $options['images'] ) {
120 $wgHTMLDump->doImageDescriptions();
121 } elseif ( $options['categories'] ) {
122 $wgHTMLDump->doCategories();
123 } elseif ( $options['redirects'] ) {
124 $wgHTMLDump->doRedirects();
125 } elseif ( $options['shared-desc'] ) {
126 $wgHTMLDump->doSharedImageDescriptions();
128 print "Creating static HTML dump in directory $dest. \n";
129 $dbr = wfGetDB( DB_SLAVE
);
130 $server = $dbr->getProperty( 'mServer' );
131 print "Using database {$server}\n";
133 if ( !isset( $options['e'] ) ) {
134 $wgHTMLDump->doEverything();
136 $wgHTMLDump->doArticles();
140 if ( isset( $options['debug'] ) ) {
142 # Workaround for bug #36957
143 $globals = array_keys( $GLOBALS );
146 foreach ( $globals as $name ) {
147 $sizes[$name] = strlen( serialize( $GLOBALS[$name] ) );
150 $sizes = array_slice( $sizes, 0, 20 );
151 foreach ( $sizes as $name => $size ) {
152 printf( "%9d %s\n", $size, $name );
157 echo $wgProfiler->getOutput();