Handle automatic reassignment of edits from duplicate accounts to the main
[lhc/web/wiklou.git] / maintenance / refreshLinks.inc
index 41dfce3..7eb6c60 100644 (file)
@@ -1,16 +1,22 @@
 <?php
+/**
+ * @todo document
+ * @package MediaWiki
+ * @subpackage Maintenance
+ */
 
+/** */
 define( "REPORTING_INTERVAL", 50 );
 define( "PAUSE_INTERVAL", 50 );
 
 function refreshLinks( $start ) {
-       global $wgUser, $wgTitle, $wgArticle, $wgEnablePersistentLC, $wgLinkCache, $wgOut;
+       global $wgUser, $wgTitle, $wgArticle, $wgLinkCache, $wgOut;
 
        $dbw =& wfGetDB( DB_MASTER );
        
-       $end = $dbw->selectField( 'cur', 'max(cur_id)', false );
+       $end = $dbw->selectField( 'page', 'max(page_id)', false );
 
-       print("Refreshing link table. Starting from cur_id $start of $end.\n");
+       print("Refreshing link table. Starting from page_id $start of $end.\n");
 
        # Don't generate TeX PNGs (lack of a sensible current directory causes errors anyway)
        $wgUser->setOption("math", 3);
@@ -35,20 +41,26 @@ function refreshLinks( $start ) {
                $text = $wgArticle->getContent( true );
                $wgLinkCache = new LinkCache;
                $wgLinkCache->forUpdate( true );
+               
+               global $wgLinkHolders;
+               $wgLinkHolders = array(
+                       'namespaces' => array(),
+                       'dbkeys' => array(),
+                       'queries' => array(),
+                       'texts' => array(),
+                       'titles' => array()
+               );
+
 
                # Parse the text and replace links with placeholders
                $wgOut->addWikiText( $text );
                
                # Look up the links in the DB and add them to the link cache
-               $wgOut->replaceLinkHolders( RLH_FOR_UPDATE );
-
-               if ( $wgEnablePersistentLC ) {
-                       $wgLinkCache->saveToLinkscc( $id, $dbw->strencode( $wgTitle->getPrefixedDBkey() ) );
-               }
+               $wgOut->transformBuffer( RLH_FOR_UPDATE );
+               $wgOut->clearHTML();
 
                $linksUpdate = new LinksUpdate( $id, $wgTitle->getPrefixedDBkey() );
                $linksUpdate->doDumbUpdate();
-               $linksUpdate->fixBrokenLinks();
                $dbw->query("COMMIT");
        }
 }