$start = isset($args[0]) ? intval($args[0]) : 0;
$overwrite = isset( $args[1] ) && $args[1] === 'overwrite';
echo "Building content page file cache from page {$start}!\n";
+echo "Format: <start> [overwrite]\n";
$dbr = wfGetDB( DB_SLAVE );
$start = $start > 0 ? $start : $dbr->selectField( 'page', 'MIN(page_id)', false, __FUNCTION__ );
$blockStart = $start;
$blockEnd = $start + $BATCH_SIZE - 1;
+$dbw = wfGetDB( DB_MASTER );
// Go through each page and save the output
while( $blockEnd <= $end ) {
// Get the pages
echo "Page {$row->page_id} already cached\n";
continue; // done already!
}
- } else {
- echo "Page {$row->page_id} not cached\n";
}
ob_start( array(&$cache, 'saveToFileCache' ) ); // save on ob_end_clean()
$wgUseFileCache = false; // hack, we don't want $wgArticle fiddling with filecache
} else {
echo "Page {$row->page_id} not cacheable\n";
}
+ $dbw->commit(); // commit any changes
}
$blockStart += $BATCH_SIZE;
$blockEnd += $BATCH_SIZE;