Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members | Related Pages

refreshLinks.inc

Go to the documentation of this file.
00001 <?php 00002 00003 define( "REPORTING_INTERVAL", 50 ); 00004 define( "PAUSE_INTERVAL", 50 ); 00005 00006 function refreshLinks( $start ) { 00007 global $wgUser, $wgTitle, $wgArticle, $wgEnablePersistentLC, $wgLinkCache, $wgOut; 00008 00009 $res = wfQuery("SELECT max(cur_id) as m FROM cur", DB_READ); 00010 $row = wfFetchObject( $res ); 00011 $end = $row->m; 00012 00013 print("Refreshing link table. Starting from cur_id $start of $end.\n"); 00014 00015 # Don't generate TeX PNGs (lack of a sensible current directory causes errors anyway) 00016 $wgUser->setOption("math", 3); 00017 00018 for ($id = $start; $id <= $end; $id++) { 00019 if ( !($id % REPORTING_INTERVAL) ) { 00020 print "$id\n"; 00021 } 00022 00023 if ( !($id % PAUSE_INTERVAL) ) { 00024 sleep(1); 00025 } 00026 00027 $wgTitle = Title::newFromID( $id ); 00028 if ( is_null( $wgTitle ) ) { 00029 continue; 00030 } 00031 00032 $wgArticle = new Article( $wgTitle ); 00033 $text = $wgArticle->getContent( true ); 00034 $wgLinkCache = new LinkCache; 00035 $wgOut->addWikiText( $text ); 00036 00037 if ( $wgEnablePersistentLC ) { 00038 $wgLinkCache->saveToLinkscc( $id, wfStrencode( $wgTitle->getPrefixedDBkey() ) ); 00039 } 00040 00041 $linksUpdate = new LinksUpdate( $id, $wgTitle->getPrefixedDBkey() ); 00042 $linksUpdate->doDumbUpdate(); 00043 $linksUpdate->fixBrokenLinks(); 00044 } 00045 } 00046 ?>

Generated on Tue Jun 29 23:40:06 2004 for Mediawiki by doxygen 1.3.7