add p_id to r-tables and delete r-data when pingbackcontent data gets deleted
[stapibas.git] / src / stapibas / Content / Fetcher.php
index 108a703c669379846111bdb5515a00fa381d0324..de912c1c5b22d21d9d311e39aa8f4ad77009ba0d 100644 (file)
@@ -56,13 +56,15 @@ class Content_Fetcher
             return;
         }
 
-        $this->db->exec(
-            'DELETE FROM pingbackcontent WHERE'
-            . ' pc_p_id = ' . $this->db->quote($pingbackRow->p_id)
-        );
+        $qPid = $this->db->quote($pingbackRow->p_id);
+        $this->db->exec('DELETE FROM pingbackcontent WHERE pc_p_id = ' . $qPid);
+        $this->db->exec('DELETE FROM rbookmarks WHERE rb_p_id = ' . $qPid);
+        $this->db->exec('DELETE FROM rcomments  WHERE rc_p_id = ' . $qPid);
+        $this->db->exec('DELETE FROM rlinks     WHERE rl_p_id = ' . $qPid);
+
         $this->db->exec(
             'INSERT INTO pingbackcontent SET'
-            . '  pc_p_id = ' . $this->db->quote($pingbackRow->p_id)
+            . '  pc_p_id = ' . $qPid
             . ', pc_mime_type = '
             . $this->db->quote($res->getHeader('content-type'))
             . ', pc_fulltext = ' . $this->db->quote($res->getBody())