From 2b9b44207375eae59b2f421b6989bcb2445ca101 Mon Sep 17 00:00:00 2001 From: Trevor Slocum Date: Tue, 22 Jun 2010 00:19:06 -0700 Subject: [PATCH] Delete .html files from res/ when posts are deleted --- inc/database_flatfile.php | 3 +++ inc/database_mysql.php | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/inc/database_flatfile.php b/inc/database_flatfile.php index b6ab2bd..603f8d5 100644 --- a/inc/database_flatfile.php +++ b/inc/database_flatfile.php @@ -172,6 +172,9 @@ function deletePostByID($id) { } if (isset($thispost)) { + if ($thispost['parent'] == 0) { + @unlink('res/' . $thispost['id'] . '.html'); + } deletePostImages($thispost); $GLOBALS['db']->deleteWhere(POSTS_FILE, new SimpleWhereClause(POST_ID, '=', $thispost['id'], INTEGER_COMPARISON)); } diff --git a/inc/database_mysql.php b/inc/database_mysql.php index 64ecb42..9d6802c 100644 --- a/inc/database_mysql.php +++ b/inc/database_mysql.php @@ -129,7 +129,11 @@ function deletePostByID($id) { } else { $thispost = $post; } - } if (isset($thispost)) { + } + if (isset($thispost)) { + if ($thispost['parent'] == 0) { + @unlink('res/' . $thispost['id'] . '.html'); + } deletePostImages($thispost); mysql_query("DELETE FROM `" . $GLOBALS['mysql_posts_table'] . "` WHERE `id` = " . $thispost['id'] . " LIMIT 1"); }