finally found the reason for the li bug, top a now in skin
[lhc/web/wiklou.git] / includes / LinksUpdate.php
index 8106e58..fe39d36 100644 (file)
@@ -1,4 +1,4 @@
-<?
+<?php
 # See deferred.doc
 
 class LinksUpdate {
@@ -21,11 +21,6 @@ class LinksUpdate {
                /* Update link tables with outgoing links from an updated article */
                /* Relies on the 'link cache' to be filled out */
 
-               if ( !$wgUseBetterLinksUpdate ) {
-                       $this->doDumbUpdate();
-                       return;
-               }
-
                $fname = "LinksUpdate::doUpdate";
                wfProfileIn( $fname );
 
@@ -43,13 +38,13 @@ class LinksUpdate {
                if ( $wgLinkCache->incrementalSetup( LINKCACHE_GOOD, $del, $add ) ) {
                        # Delete where necessary
                        if ( count( $del ) ) {
-                               $sql = "DELETE FROM links WHERE l_from='{$this->mTitleEnc}' AND l_to IN(".
+                               $sql = "DELETE FROM links WHERE l_from={$this->mId} AND l_to IN(".
                                        implode( ",", $del ) . ")";
                                wfQuery( $sql, DB_WRITE, $fname );
                        }
                } else {
                        # Delete everything
-                       $sql = "DELETE FROM links WHERE l_from='{$this->mTitleEnc}'";
+                       $sql = "DELETE FROM links WHERE l_from={$this->mId}";
                        wfQuery( $sql, DB_WRITE, $fname );
                        
                        # Get the addition list
@@ -66,7 +61,7 @@ class LinksUpdate {
                                if ( ! $first ) { $sql .= ","; }
                                $first = false;
 
-                               $sql .= "('{$this->mTitleEnc}',{$lid})";
+                               $sql .= "({$this->mId},{$lid})";
                        }
                }
                if ( "" != $sql ) { 
@@ -111,7 +106,7 @@ class LinksUpdate {
 
                #------------------------------------------------------------------------------
                # Image links
-               $sql = "DELETE FROM imagelinks WHERE il_from='{$this->mTitleEnc}'";
+               $sql = "DELETE FROM imagelinks WHERE il_from='{$this->mId}'";
                wfQuery( $sql, DB_WRITE, $fname );
                
                # Get addition list
@@ -133,7 +128,7 @@ class LinksUpdate {
                                if ( ! $first ) { $sql .= ","; }
                                $first = false;
 
-                               $sql .= "('{$this->mTitleEnc}','{$iname}')";
+                               $sql .= "({$this->mId},'{$iname}')";
                        }
                }
                if ( "" != $sql ) { wfQuery( $sql, DB_WRITE, $fname ); }
@@ -146,11 +141,12 @@ class LinksUpdate {
                }
                wfProfileOut( $fname );
        }
-
+       
        function doDumbUpdate()
        {
-               # Old update function. This can probably be removed eventually, if the new one
-               # proves to be stable
+               # Old inefficient update function
+               # Used for rebuilding the link table
+               
                global $wgLinkCache, $wgDBtransactions;
                $fname = "LinksUpdate::doDumbUpdate";
                wfProfileIn( $fname );
@@ -160,7 +156,7 @@ class LinksUpdate {
                        wfQuery( $sql, DB_WRITE, $fname );
                }
                
-               $sql = "DELETE FROM links WHERE l_from='{$this->mTitleEnc}'";
+               $sql = "DELETE FROM links WHERE l_from={$this->mId}";
                wfQuery( $sql, DB_WRITE, $fname );
 
                $a = $wgLinkCache->getGoodLinks();
@@ -172,7 +168,7 @@ class LinksUpdate {
                                if ( ! $first ) { $sql .= ","; }
                                $first = false;
 
-                               $sql .= "('{$this->mTitleEnc}',{$lid})";
+                               $sql .= "({$this->mId},{$lid})";
                        }
                }
                if ( "" != $sql ) { wfQuery( $sql, DB_WRITE, $fname ); }
@@ -195,7 +191,7 @@ class LinksUpdate {
                }
                if ( "" != $sql ) { wfQuery( $sql, DB_WRITE, $fname ); }
                
-               $sql = "DELETE FROM imagelinks WHERE il_from='{$this->mTitleEnc}'";
+               $sql = "DELETE FROM imagelinks WHERE il_from={$this->mId}";
                wfQuery( $sql, DB_WRITE, $fname );
 
                $a = $wgLinkCache->getImageLinks();
@@ -208,7 +204,7 @@ class LinksUpdate {
                                if ( ! $first ) { $sql .= ","; }
                                $first = false;
 
-                               $sql .= "('{$this->mTitleEnc}','{$iname}')";
+                               $sql .= "({$this->mId},'{$iname}')";
                        }
                }
                if ( "" != $sql ) { wfQuery( $sql, DB_WRITE, $fname ); }
@@ -225,6 +221,7 @@ class LinksUpdate {
        function fixBrokenLinks() {
                /* Update any brokenlinks *to* this page */
                /* Call for a newly created page, or just to make sure state is consistent */
+               $fname = "LinksUpdate::fixBrokenLinks";
                
                $sql = "SELECT bl_from FROM brokenlinks WHERE bl_to='{$this->mTitleEnc}'";
                $res = wfQuery( $sql, DB_READ, $fname );
@@ -237,9 +234,8 @@ class LinksUpdate {
                while ( $row = wfFetchObject( $res ) ) {
                        if ( ! $first ) { $sql .= ","; $sql2 .= ","; }
                        $first = false;
-                       $nl = wfStrencode( Title::nameOf( $row->bl_from ) );
 
-                       $sql .= "('{$nl}',{$this->mId})";
+                       $sql .= "({$row->bl_from},{$this->mId})";
                        $sql2 .= $row->bl_from;
                }
                $sql2 .= ")";