Some changes to the link tables. They now all use a key on cur_id for the *_from...
[lhc/web/wiklou.git] / includes / SquidUpdate.php
index 45e4883..27ee985 100644 (file)
@@ -2,31 +2,29 @@
 # See deferred.doc
 
 class SquidUpdate {
-
-       function SquidUpdate( $title, $urlArr = Array() )
-       {
+       var $title, $urlArr;
+       
+       function SquidUpdate( $title, $urlArr = Array() ) {
                $this->title = $title;
                $this->urlArr = $urlArr;
        }
 
 
-       function doUpdate()
-       {
-               if (count( $this->urlArr ) == 0) { // newly created Article
-                       /* prepare the list of urls to purge */
+       function doUpdate() {
+               if( count( $this->urlArr ) == 0) {
+                       # newly created Article
+                       # prepare the list of urls to purge
                        $id= $this->title->getArticleID();
-                       $sql = "SELECT l_from FROM links WHERE l_to={$id}" ;
-                       $res = wfQuery ( $sql, DB_READ ) ;
-                       while ( $BL = wfFetchObject ( $res ) )
-                       {
-                               $t = Title::newFromDBkey( $BL->l_from) ; 
-                               $this->urlArr[] = $t->getInternalURL() ;
+                       $sql = "SELECT cur_namespace,cur_title FROM links,cur WHERE l_to={$id} AND l_from=cur_id" ;
+                       $res = wfQuery( $sql, DB_READ );
+                       while( $row = wfFetchObject ( $res ) ) {
+                               $t = Title::MakeTitle( $row->cur_namespace, $row->cur_title );
+                               $this->urlArr[] = $t->getInternalURL();
                        }
-                       wfFreeResult ( $res ) ;
-
+                       wfFreeResult( $res );
                }
 
-               wfPurgeSquidServers($this->urlArr);
+               wfPurgeSquidServers( $this->urlArr );
        }
 }