Fix incremental link update with persistent linkcache
authorBrion Vibber <brion@users.mediawiki.org>
Tue, 25 Nov 2003 06:57:24 +0000 (06:57 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Tue, 25 Nov 2003 06:57:24 +0000 (06:57 +0000)
includes/Article.php
includes/LinkCache.php

index 08594ba..282886a 100644 (file)
@@ -492,6 +492,7 @@ class Article {
                          "WHERE rc_cur_id=" . $this->getID();
                        wfQuery( $sql, DB_WRITE, $fname );
                        
+                       global $wgEnablePersistentLC;
                        if ( $wgEnablePersistentLC ) {
 
                                // Purge link cache for this page 
index 80e7c5c..108f887 100644 (file)
@@ -154,10 +154,11 @@ class LinkCache {
                        if( $row != FALSE){
                                $cacheobj = gzuncompress( $row->lcc_cacheobj );
                                $cc = unserialize( $cacheobj );
-                               $this->mGoodLinks = $cc->mGoodLinks;
-                               $this->mBadLinks = $cc->mBadLinks;
+                               $this->mOldGoodLinks = $this->mGoodLinks = $cc->mGoodLinks;
+                               $this->mOldBadLinks = $this->mBadLinks = $cc->mBadLinks;
                                $this->mPreFilled = true;
                                wfProfileOut( $fname );
+                               wfDebug( "LinkCache::preFill - got from linkscc\n" );
                                return;
                        } 
                }
@@ -194,6 +195,7 @@ class LinkCache {
                        $serCachegz = wfStrencode( gzcompress( serialize( $this ), 3) );
                        wfQuery("REPLACE INTO linkscc VALUES({$id}, '{$dbkeyfrom}', '{$serCachegz}')", 
                                DB_WRITE);
+                               wfDebug( "LinkCache::preFill - saved to linkscc\n" );
                }
 
                wfProfileOut( $fname );
@@ -206,6 +208,8 @@ class LinkCache {
 
        function getBadAdditions() 
        {
+               #wfDebug( "mOldBadLinks: " . implode( ', ', array_keys( $this->mOldBadLinks ) ) . "\n" );
+               #wfDebug( "mBadLinks: " . implode( ', ', array_keys( $this->mBadLinks ) ) . "\n" );
                return array_values( array_diff( array_keys( $this->mBadLinks ), array_keys( $this->mOldBadLinks ) ) );
        }