From c8a733d04a723ce4a5a625a53593a0067ee036d0 Mon Sep 17 00:00:00 2001 From: Fredrick Brennan Date: Fri, 3 Apr 2015 15:06:29 +0800 Subject: [PATCH] Oops, forgot about media/cites --- post.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/post.php b/post.php index a18633c3..16c6a71d 100644 --- a/post.php +++ b/post.php @@ -909,10 +909,14 @@ elseif (isset($_POST['post'])) { // Handle cyclical threads if (!$post['op'] && isset($thread['cycle']) && $thread['cycle']) { // Query is a bit weird due to "This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'" (MariaDB Ver 15.1 Distrib 10.0.17-MariaDB, for Linux (x86_64)) - $query = prepare(sprintf('DELETE FROM ``posts_%s`` WHERE `thread` = :thread AND `id` NOT IN (SELECT `id` FROM (SELECT `id` FROM ``posts_%s`` WHERE `thread` = :thread ORDER BY `id` DESC LIMIT :limit) i)', $board['uri'], $board['uri'])); + $query = prepare(sprintf('SELECT `id` FROM ``posts_%s`` WHERE `thread` = :thread AND `id` NOT IN (SELECT `id` FROM (SELECT `id` FROM ``posts_%s`` WHERE `thread` = :thread ORDER BY `id` DESC LIMIT :limit) i)', $board['uri'], $board['uri'])); $query->bindValue(':thread', $post['thread']); $query->bindValue(':limit', $config['cycle_limit'], PDO::PARAM_INT); $query->execute() or error(db_error($query)); + + while ($dpost = $query->fetch()) { + deletePost($dpost['id'], false, false); + } } if (isset($post['antispam_hash'])) {