r44457 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r44456‎ | r44457 | r44458 >
Date:18:59, 11 December 2008
Author:aaron
Status:ok
Tags:
Comment:
*Disabled hit counter
*Added 'overwrite' option
Modified paths:
  • /trunk/phase3/maintenance/rebuildFileCache.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/rebuildFileCache.php
@@ -12,8 +12,10 @@
1313 echo "Nothing to do -- \$wgUseFileCache is disabled.\n";
1414 exit(0);
1515 }
 16+$wgDisableCounters = false; // no real hits here
1617
1718 $start = isset($args[0]) ? intval($args[0]) : 0;
 19+$overwrite = isset( $args[1] ) && $args[1] === 'overwrite';
1820 echo "Building content page file cache from page {$start}!\n";
1921
2022 $dbr = wfGetDB( DB_SLAVE );
@@ -41,6 +43,7 @@
4244 array('ORDER BY' => 'page_id ASC','USE INDEX' => 'PRIMARY')
4345 );
4446 while( $row = $dbr->fetchObject( $res ) ) {
 47+ $rebuilt = false;
4548 $wgTitle = Title::makeTitleSafe( $row->page_namespace, $row->page_title );
4649 if( null == $wgTitle ) {
4750 echo "Page {$row->page_id} bad title\n";
@@ -51,8 +54,12 @@
5255 if( $wgArticle->isFileCacheable() ) {
5356 $cache = new HTMLFileCache( $wgTitle );
5457 if( $cache->isFileCacheGood() ) {
55 - echo "Page {$row->page_id} already cached\n";
56 - continue; // done already!
 58+ if( $overwrite ) {
 59+ $rebuilt = true;
 60+ } else {
 61+ echo "Page {$row->page_id} already cached\n";
 62+ continue; // done already!
 63+ }
5764 } else {
5865 echo "Page {$row->page_id} not cached\n";
5966 }
@@ -63,7 +70,10 @@
6471 $wgUseFileCache = true;
6572 ob_end_clean(); // clear buffer
6673 $wgOut = new OutputPage(); // empty out any output page garbage
67 - echo "Cached page {$row->page_id}\n";
 74+ if( $rebuilt )
 75+ echo "Re-cached page {$row->page_id}\n";
 76+ else
 77+ echo "Cached page {$row->page_id}\n";
6878 } else {
6979 echo "Page {$row->page_id} not cacheable\n";
7080 }

Status & tagging log