1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-11-30 18:24:29 +01:00

Moved several DELETE queries into one

This commit is contained in:
Savetheinternet 2010-12-16 20:29:35 +11:00
parent 130efdf467
commit 9e2a8f248d

View File

@ -158,12 +158,10 @@
// Delete posts and maybe replies // Delete posts and maybe replies
while($post = mysql_fetch_array($post_res)) { while($post = mysql_fetch_array($post_res)) {
if(!$post['thread']) { if(!$post['thread']) {
// Delete thread HTML page // Delete thread HTML page
@unlink($board['dir'] . DIR_RES . sprintf(FILE_PAGE, $post['id'])); @unlink($board['dir'] . DIR_RES . sprintf(FILE_PAGE, $post['id']));
} }
if($post['thumb']) { if($post['thumb']) {
// Delete thumbnail // Delete thumbnail
@unlink($board['dir'] . DIR_THUMB . $post['thumb']); @unlink($board['dir'] . DIR_THUMB . $post['thumb']);
@ -172,13 +170,13 @@
// Delete file // Delete file
@unlink($board['dir'] . DIR_IMG . $post['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));
} }
?> ?>