Delete .html files from res/ when posts are deleted

This commit is contained in:
Trevor Slocum 2010-06-22 00:19:06 -07:00
parent b908d035e7
commit 2b9b442073
2 changed files with 8 additions and 1 deletions

View File

@ -172,6 +172,9 @@ function deletePostByID($id) {
} }
if (isset($thispost)) { if (isset($thispost)) {
if ($thispost['parent'] == 0) {
@unlink('res/' . $thispost['id'] . '.html');
}
deletePostImages($thispost); deletePostImages($thispost);
$GLOBALS['db']->deleteWhere(POSTS_FILE, new SimpleWhereClause(POST_ID, '=', $thispost['id'], INTEGER_COMPARISON)); $GLOBALS['db']->deleteWhere(POSTS_FILE, new SimpleWhereClause(POST_ID, '=', $thispost['id'], INTEGER_COMPARISON));
} }

View File

@ -129,7 +129,11 @@ function deletePostByID($id) {
} else { } else {
$thispost = $post; $thispost = $post;
} }
} if (isset($thispost)) { }
if (isset($thispost)) {
if ($thispost['parent'] == 0) {
@unlink('res/' . $thispost['id'] . '.html');
}
deletePostImages($thispost); deletePostImages($thispost);
mysql_query("DELETE FROM `" . $GLOBALS['mysql_posts_table'] . "` WHERE `id` = " . $thispost['id'] . " LIMIT 1"); mysql_query("DELETE FROM `" . $GLOBALS['mysql_posts_table'] . "` WHERE `id` = " . $thispost['id'] . " LIMIT 1");
} }