diff options
Diffstat (limited to 'inc/functions.php')
| -rwxr-xr-x | inc/functions.php | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/inc/functions.php b/inc/functions.php index ed00743c..9283c3ae 100755 --- a/inc/functions.php +++ b/inc/functions.php @@ -1279,11 +1279,28 @@ function clean($pid = false) { $query->bindValue(':offset', $offset, PDO::PARAM_INT); $query->execute() or error(db_error($query)); + if ($config['early_404_staged']) { + $page = $config['early_404_page']; + $iter = 0; + } + else { + $page = 1; + } + while ($post = $query->fetch(PDO::FETCH_ASSOC)) { - if ($post['reply_count'] < $config['early_404_replies']) { + if ($post['reply_count'] < $page*$config['early_404_replies']) { deletePost($post['thread_id'], false, false); if ($pid) modLog("Automatically deleting thread #{$post['thread_id']} due to new thread #{$pid} (early 404 is set, #{$post['thread_id']} had {$post['reply_count']} replies)"); } + + if ($config['early_404_staged']) { + $iter++; + + if ($iter == $config['threads_per_page']) { + $page++; + $iter = 0; + } + } } } } @@ -1310,6 +1327,7 @@ function index($page, $mod=false, $brief = false) { $query->bindValue(':threads_per_page', $config['threads_per_page'], PDO::PARAM_INT); $query->execute() or error(db_error($query)); + if ($page == 1 && $query->rowCount() < $config['threads_per_page']) $board['thread_count'] = $query->rowCount(); |
