summaryrefslogtreecommitdiff
path: root/inc/functions.php
diff options
context:
space:
mode:
authorMichael Save <savetheinternet@tinyboard.org>2012-04-11 17:36:34 +1000
committerMichael Save <savetheinternet@tinyboard.org>2012-04-11 17:36:34 +1000
commit88092e4f9e50e94f094e55c54a6150df104043b1 (patch)
treeaea80f6a46763d2af918e789fd76613f242c863b /inc/functions.php
parentc0968639c44a28478a466bcb3084cb66a13a3128 (diff)
Bugfix: some tracked post citations were not being purged upon thread deletion
Diffstat (limited to 'inc/functions.php')
-rw-r--r--inc/functions.php8
1 files changed, 6 insertions, 2 deletions
diff --git a/inc/functions.php b/inc/functions.php
index 5f00cfdb..3592512e 100644
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -829,6 +829,8 @@
else return false;
}
+ $ids = array();
+
// Delete posts and maybe replies
while($post = $query->fetch()) {
if(!$post['thread']) {
@@ -846,15 +848,17 @@
// Delete file
file_unlink($board['dir'] . $config['dir']['img'] . $post['file']);
}
+
+ $ids[] = (int)$post['id'];
+
}
$query = prepare(sprintf("DELETE FROM `posts_%s` WHERE `id` = :id OR `thread` = :id", $board['uri']));
$query->bindValue(':id', $id, PDO::PARAM_INT);
$query->execute() or error(db_error($query));
- $query = prepare("SELECT `board`, `post` FROM `cites` WHERE `target_board` = :board AND `target` = :id");
+ $query = prepare("SELECT `board`, `post` FROM `cites` WHERE `target_board` = :board AND (`target` = " . implode(' OR `target` = ', $ids) . ")");
$query->bindValue(':board', $board['uri']);
- $query->bindValue(':id', $id, PDO::PARAM_INT);
$query->execute() or error(db_error($query));
while($cite = $query->fetch()) {
if($board['uri'] != $cite['board']) {