$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');
    print "Using database {$server}\n";
    if (!isset($options['e'])) {
        $wgHTMLDump->doEverything();
    } else {
        $wgHTMLDump->doArticles();
    }
}
if (isset($options['debug'])) {
    #print_r($GLOBALS);
    # Workaround for bug #36957
    $globals = array_keys($GLOBALS);
    #sort( $globals );
    $sizes = array();
    foreach ($globals as $name) {
        $sizes[$name] = strlen(serialize($GLOBALS[$name]));
    }
    arsort($sizes);
    $sizes = array_slice($sizes, 0, 20);
    foreach ($sizes as $name => $size) {
        printf("%9d %s\n", $size, $name);
}
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
    	// This is a memory/resource leak workaround
    	print("Creating static HTML dump in directory $dest. \n".
    		"Starting from page_id $start of $end.\n");
    
    	chdir( "maintenance" );
    	for ( $chunkStart = $start; $chunkStart < $end; $chunkStart += CHUNK_SIZE ) {
    		$chunkEnd = $chunkStart + CHUNK_SIZE - 1;
    		if ( $chunkEnd > $end ) {
    			$chunkEnd = $end;
Beispiel #3
0
$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'])) {
        $wgHTMLDump->doImageDescriptions();
        $wgHTMLDump->doCategories();
        $wgHTMLDump->doSpecials();
    }
    /*
    if ( $end - $start > CHUNK_SIZE * 2 ) {
    	// Split the problem into smaller chunks, run them in different PHP instances
    	// This is a memory/resource leak workaround
    	print("Creating static HTML dump in directory $dest. \n".
    		"Starting from page_id $start of $end.\n");
    
    	chdir( "maintenance" );
    	for ( $chunkStart = $start; $chunkStart < $end; $chunkStart += CHUNK_SIZE ) {
    		$chunkEnd = $chunkStart + CHUNK_SIZE - 1;