diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html
index 7331101ea7..e9a58c9bd9 100644
--- a/phpBB/docs/CHANGELOG.html
+++ b/phpBB/docs/CHANGELOG.html
@@ -116,7 +116,7 @@ h3 {font-size:12pt;color:blue}
Changed user topic notification default in schemas to 0 (off)
Fixed non-XHTML compliant img tags in privmsg.php
Fixed non-deletion of announcements and polls when removing forum contents in forum admin
-
+Fixed non-pruning of watched topics table when pruning related topics
diff --git a/phpBB/includes/prune.php b/phpBB/includes/prune.php
index c9cb6fe4c6..ae4d8ae002 100644
--- a/phpBB/includes/prune.php
+++ b/phpBB/includes/prune.php
@@ -76,9 +76,16 @@ function prune($forum_id, $prune_date, $prune_all = false;)
if ( $sql_post != '' )
{
- $sql = "DELETE FROM " . TOPICS_TABLE . "
+ $sql = "DELETE FROM " . TOPICS_WATCH_TABLE . "
WHERE topic_id IN ($sql_topics)";
if ( !$db->sql_query($sql, BEGIN_TRANSACTION) )
+ {
+ message_die(GENERAL_ERROR, 'Could not delete watched topics during prune', '', __LINE__, __FILE__, $sql);
+ }
+
+ $sql = "DELETE FROM " . TOPICS_TABLE . "
+ WHERE topic_id IN ($sql_topics)";
+ if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not delete topics during prune', '', __LINE__, __FILE__, $sql);
}