Add color to the output; assumes a more or less ANSI-flavored terminal.
[lhc/web/wiklou.git] / maintenance / refreshLinks.inc
index 2261803..82bf29a 100644 (file)
@@ -1,5 +1,12 @@
 <?php
+/**
+ * @todo document
+ * @package MediaWiki
+ * @subpackage Maintenance
+ * @version $Id$
+ */
 
+/** */
 define( "REPORTING_INTERVAL", 50 );
 define( "PAUSE_INTERVAL", 50 );
 
@@ -15,9 +22,6 @@ function refreshLinks( $start ) {
        # Don't generate TeX PNGs (lack of a sensible current directory causes errors anyway)
        $wgUser->setOption("math", 3);
        
-       # Turn on link cache in skin
-       $sk =& $wgUser->getSkin();
-       $sk->postParseLinkColour( false );
 
        for ($id = $start; $id <= $end; $id++) {
                if ( !($id % REPORTING_INTERVAL) ) {
@@ -32,20 +36,33 @@ function refreshLinks( $start ) {
                if ( is_null( $wgTitle ) ) {
                        continue;
                }
-               
+               $dbw->query("BEGIN");
+
                $wgArticle = new Article( $wgTitle );
                $text = $wgArticle->getContent( true );
                $wgLinkCache = new LinkCache;
                $wgLinkCache->forUpdate( true );
+
+               # 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->transformBuffer( RLH_FOR_UPDATE );
+               $wgOut->clearHTML();
 
                if ( $wgEnablePersistentLC ) {
                        $wgLinkCache->saveToLinkscc( $id, $dbw->strencode( $wgTitle->getPrefixedDBkey() ) );
                }
 
                $linksUpdate = new LinksUpdate( $id, $wgTitle->getPrefixedDBkey() );
+               /** FIXME 
+                * In ./includes/LinksUpdate.php doDumbUpdate is commented with:
+                * "Old inefficient update function"
+                * Probably need to call doUpdate instead.
+               */
                $linksUpdate->doDumbUpdate();
                $linksUpdate->fixBrokenLinks();
+               $dbw->query("COMMIT");
        }
 }
 ?>