mirror of
https://github.com/vichan-devel/vichan.git
synced 2024-11-13 18:40:49 +01:00
early 404 staged
This commit is contained in:
parent
736e982945
commit
40fe35fedc
@ -524,6 +524,7 @@
|
||||
|
||||
$config['early_404_page'] = 3;
|
||||
$config['early_404_replies'] = 5;
|
||||
$config['early_404_staged'] = false;
|
||||
|
||||
// A wordfilter (sometimes referred to as just a "filter" or "censor") automatically scans users’ posts
|
||||
// as they are submitted and changes or censors particular words or phrases.
|
||||
|
@ -1311,11 +1311,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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user