DO NOT USE ! Simple database layer for postgresql based on existing mysql one. I...
[lhc/web/wiklou.git] / maintenance / refreshLinks.php
index c444ab0..089e6a7 100644 (file)
@@ -1,7 +1,8 @@
 <?php
-define( "REPORTING_INTERVAL", 500 );
+define( "REPORTING_INTERVAL", 50 );
+define( "PAUSE_INTERVAL", 50 );
 
-include_once( "commandLine.inc" );
+require_once( "commandLine.inc" );
 error_reporting( E_ALL & (~E_NOTICE) );
 
 
@@ -17,27 +18,37 @@ $end = $row->m;
 
 print("Refreshing link table. Starting from cur_id $start of $end.\n");
 
+# Don't generate TeX PNGs (lack of a sensible current directory causes errors anyway)
 $wgUser->setOption("math", 3);
+
 for ($id = $start; $id <= $end; $id++) {
        if ( !($id % REPORTING_INTERVAL) ) {
                print "$id\n";
        }
+
+       if ( !($id % PAUSE_INTERVAL) ) {
+               sleep(1);
+       }
        
        $wgTitle = Title::newFromID( $id );
        if ( is_null( $wgTitle ) ) {
                continue;
        }
        
-       $wgLinkCache = new LinkCache;
        $wgArticle = new Article( $wgTitle );
        $text = $wgArticle->getContent( true );
+       $wgLinkCache = new LinkCache;
        @$wgOut->addWikiText( $text );
-       
-       $linksUpdate = new LinksUpdate( $id, $wgTitle );
+
+       if ( $wgEnablePersistentLC ) {
+               $wgLinkCache->saveToLinkscc( $id, wfStrencode( $wgTitle->getPrefixedDBkey() ) );
+       }
+
+       $linksUpdate = new LinksUpdate( $id, $wgTitle->getPrefixedDBkey() );
        $linksUpdate->doDumbUpdate();
+       $linksUpdate->fixBrokenLinks();
 }
 
-
 exit();
 
 ?>