summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSavetheinternet <savetheinternet@n0v4.com>2010-12-16 20:29:35 +1100
committerSavetheinternet <savetheinternet@n0v4.com>2010-12-16 20:29:35 +1100
commit9e2a8f248dd3cd11ba7b574935aeff9190b9fcc6 (patch)
tree596ea3d413310b3c77d77a12dfed8b4fd4a1caa0
parent130efdf467ed59670f108924199a42a33a26b5d2 (diff)
Moved several DELETE queries into one
-rw-r--r--inc/mod.php16
1 files changed, 7 insertions, 9 deletions
diff --git a/inc/mod.php b/inc/mod.php
index a6cf3793..200ffa20 100644
--- a/inc/mod.php
+++ b/inc/mod.php
@@ -158,12 +158,10 @@
// Delete posts and maybe replies
while($post = mysql_fetch_array($post_res)) {
-
if(!$post['thread']) {
// Delete thread HTML page
@unlink($board['dir'] . DIR_RES . sprintf(FILE_PAGE, $post['id']));
}
-
if($post['thumb']) {
// Delete thumbnail
@unlink($board['dir'] . DIR_THUMB . $post['thumb']);
@@ -172,13 +170,13 @@
// Delete file
@unlink($board['dir'] . DIR_IMG . $post['file']);
}
-
- // Delete post
- mysql_query(sprintf(
- "DELETE FROM `posts_%s` WHERE `id` = '%d'",
- mysql_real_escape_string($board['uri']),
- $post['id']
- ), $sql) or error(mysql_error($sql));
}
+
+ mysql_query(sprintf(
+ "DELETE FROM `posts_%s` WHERE `id` = '%d' OR `thread` = '%d'",
+ mysql_real_escape_string($board['uri']),
+ $id,
+ $id
+ ), $sql) or error(mysql_error($sql));
}
?> \ No newline at end of file