Index: trunk/phase3/maintenance/rebuildFileCache.php |
— | — | @@ -12,8 +12,10 @@ |
13 | 13 | echo "Nothing to do -- \$wgUseFileCache is disabled.\n"; |
14 | 14 | exit(0); |
15 | 15 | } |
| 16 | +$wgDisableCounters = false; // no real hits here |
16 | 17 | |
17 | 18 | $start = isset($args[0]) ? intval($args[0]) : 0; |
| 19 | +$overwrite = isset( $args[1] ) && $args[1] === 'overwrite'; |
18 | 20 | echo "Building content page file cache from page {$start}!\n"; |
19 | 21 | |
20 | 22 | $dbr = wfGetDB( DB_SLAVE ); |
— | — | @@ -41,6 +43,7 @@ |
42 | 44 | array('ORDER BY' => 'page_id ASC','USE INDEX' => 'PRIMARY') |
43 | 45 | ); |
44 | 46 | while( $row = $dbr->fetchObject( $res ) ) { |
| 47 | + $rebuilt = false; |
45 | 48 | $wgTitle = Title::makeTitleSafe( $row->page_namespace, $row->page_title ); |
46 | 49 | if( null == $wgTitle ) { |
47 | 50 | echo "Page {$row->page_id} bad title\n"; |
— | — | @@ -51,8 +54,12 @@ |
52 | 55 | if( $wgArticle->isFileCacheable() ) { |
53 | 56 | $cache = new HTMLFileCache( $wgTitle ); |
54 | 57 | 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 | + } |
57 | 64 | } else { |
58 | 65 | echo "Page {$row->page_id} not cached\n"; |
59 | 66 | } |
— | — | @@ -63,7 +70,10 @@ |
64 | 71 | $wgUseFileCache = true; |
65 | 72 | ob_end_clean(); // clear buffer |
66 | 73 | $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"; |
68 | 78 | } else { |
69 | 79 | echo "Page {$row->page_id} not cacheable\n"; |
70 | 80 | } |