} else { $dest = "{$IP}/static"; } $skin = isset($options['k']) ? $options['k'] : 'offline'; if ($options['slice']) { $bits = explode('/', $options['slice']); if (count($bits) != 2 || $bits[0] < 1 || $bits[0] > $bits[1]) { print "Invalid slice specification"; exit; } $sliceNumerator = $bits[0]; $sliceDenominator = $bits[1]; } else { $sliceNumerator = $sliceDenominator = 1; } $wgHTMLDump = new DumpHTML(array('dest' => $dest, 'forceCopy' => $options['force-copy'], 'alternateScriptPath' => $options['interlang'], 'interwiki' => $options['interlang'], 'skin' => $skin, 'makeSnapshot' => $options['image-snapshot'], 'checkpointFile' => $options['checkpoint'], 'startID' => $start, 'endID' => $end, 'sliceNumerator' => $sliceNumerator, 'sliceDenominator' => $sliceDenominator, 'noOverwrite' => $options['no-overwrite'], 'compress' => $options['compress'], 'noSharedDesc' => $options['no-shared-desc'], 'udpProfile' => $options['udp-profile'], 'showTitles' => $options['show-titles'], 'group' => $options['group'])); $wgHTMLDump->setupDestDir(); if ($options['special']) { $wgHTMLDump->doSpecials(); } elseif ($options['images']) { $wgHTMLDump->doImageDescriptions(); } elseif ($options['categories']) { $wgHTMLDump->doCategories(); } elseif ($options['redirects']) { $wgHTMLDump->doRedirects(); } elseif ($options['shared-desc']) { $wgHTMLDump->doSharedImageDescriptions(); } else { print "Creating static HTML dump in directory {$dest}. \n"; $dbr = wfGetDB(DB_SLAVE); $server = $dbr->getProperty('mServer');
$start = $options['s']; } else { $start = 1; } if (!empty($options['e'])) { $end = $options['e']; } else { $dbr =& wfGetDB(DB_SLAVE); $end = $dbr->selectField('page', 'max(page_id)', false); } if (!empty($options['d'])) { $dest = $options['d']; } else { $dest = 'static'; } $d = new DumpHTML(array('dest' => $dest, 'forceCopy' => $options['force-copy'], 'alternateScriptPath' => $options['interlang'], 'interwiki' => $options['interlang'])); if ($options['special']) { $d->doSpecials(); } elseif ($options['images']) { $d->doImageDescriptions(); } elseif ($options['categories']) { $d->doCategories(); } else { print "Creating static HTML dump in directory {$dest}. \n" . "Starting from page_id {$start} of {$end}.\n"; $d->doArticles($start, $end); $d->doImageDescriptions(); $d->doCategories(); $d->doSpecials(); /* if ( $end - $start > CHUNK_SIZE * 2 ) { // Split the problem into smaller chunks, run them in different PHP instances
} else { $start = 1; } if (!empty($options['e'])) { $end = $options['e']; } else { $dbr =& wfGetDB(DB_SLAVE); $end = $dbr->selectField('page', 'max(page_id)', false); } if (!empty($options['d'])) { $dest = $options['d']; } else { $dest = 'static'; } $skin = isset($options['k']) ? $options['k'] : 'dumphtml'; $wgHTMLDump = new DumpHTML(array('dest' => $dest, 'forceCopy' => $options['force-copy'], 'alternateScriptPath' => $options['interlang'], 'interwiki' => $options['interlang'], 'skin' => $skin)); if ($options['special']) { $wgHTMLDump->doSpecials(); } elseif ($options['images']) { $wgHTMLDump->doImageDescriptions(); } elseif ($options['categories']) { $wgHTMLDump->doCategories(); } elseif ($options['redirects']) { $wgHTMLDump->doRedirects(); } else { print "Creating static HTML dump in directory {$dest}. \n" . "Starting from page_id {$start} of {$end}.\n"; $dbr =& wfGetDB(DB_SLAVE); $server = $dbr->getProperty('mServer'); print "Using database {$server}\n"; $wgHTMLDump->doArticles($start, $end); if (!isset($options['e'])) {