diff msite.inc.php @ 1032:9fffc9e7e1b6

Add stDeleteCompoEntry() and use it.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 19 Nov 2015 21:57:19 +0200
parents 35a00a986f79
children 03f4b70a2ce8
line wrap: on
line diff
--- a/msite.inc.php	Thu Nov 19 21:08:40 2015 +0200
+++ b/msite.inc.php	Thu Nov 19 21:57:19 2015 +0200
@@ -1345,4 +1345,20 @@
 }
 
 
+function stDeleteCompoEntry($id)
+{
+  // Delete entry itself
+  $sql = stPrepareSQL("DELETE FROM entries WHERE id=%d", $id);
+  stExecSQLCond($sql, "OK, entry ".$id." deleted.");
+
+  // Delete votes for the entry
+  $sql = stPrepareSQL("DELETE FROM votes WHERE entry_id=%d", $id);
+  stExecSQLCond($sql, "OK, entry ".$id." votes deleted.");
+  
+  // Mark related files to be deleted
+  $sql = stPrepareSQL("UPDATE files SET deleted=%d WHERE entry_id=%d", 1, $id);
+  stExecSQLCond($sql, "OK, entry ".$id." files marked.");
+}
+
+
 ?>
\ No newline at end of file