Avoid saving to linkscc if the article doesn't exist; this leaves
authorBrion Vibber <brion@users.mediawiki.org>
Sun, 21 Dec 2003 06:33:57 +0000 (06:33 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Sun, 21 Dec 2003 06:33:57 +0000 (06:33 +0000)
corrupt entries in the table. Also, include the column names in
the REPLACE statement to guard against potential ordering problems
in databases that are manually munged around.

includes/LinkCache.php

index 63e7326..554a7ca 100644 (file)
@@ -178,6 +178,12 @@ class LinkCache {
                $id = $fromtitle->getArticleID();
                $this->resume();
                
+               if( $id == 0 ) {
+                       wfDebug( "$fname - got id 0 for title '" . $fromtitle->getPrefixedDBkey() . "'\n" );
+                       wfProfileOut( $fname );
+                       return;
+               }
+               
                $sql = "SELECT bl_to
                        FROM brokenlinks
                        WHERE bl_from='{$id}'";
@@ -197,9 +203,9 @@ class LinkCache {
                        } else {
                                $ser = wfStrencode( serialize( $this ) );
                        }
-                       wfQuery("REPLACE INTO linkscc VALUES({$id}, '{$dbkeyfrom}', '{$ser}')", 
+                       wfQuery("REPLACE INTO linkscc(lcc_pageid,lcc_title,lcc_cacheobj) VALUES({$id}, '{$dbkeyfrom}', '{$ser}')", 
                                DB_WRITE);
-                               wfDebug( "LinkCache::preFill - saved to linkscc\n" );
+                               wfDebug( "$fname - saved to linkscc\n" );
                }
 
                wfProfileOut( $fname );