anti-bot.php: make automated antispam puring optional

This commit is contained in:
Zankaria 2024-07-08 23:58:54 +02:00
parent 6cf574a998
commit 7613eda52b

View file

@ -196,9 +196,9 @@ function _create_antibot($board, $thread) {
$antibot = new AntiBot(array($board, $thread)); $antibot = new AntiBot(array($board, $thread));
// Delete old expired antispam, skipping those with NULL expiration timestamps (infinite lifetime). // Delete old expired antispam, skipping those with NULL expiration timestamps (infinite lifetime).
if (!isset($purged_old_antispam)) { if (!isset($purged_old_antispam) && $config['auto_maintenance']) {
$purged_old_antispam = true; $purged_old_antispam = true;
query('DELETE FROM ``antispam`` WHERE `expires` < UNIX_TIMESTAMP()') or error(db_error()); purge_old_antispam();
} }
// Keep the now invalid timestamps around for a bit to enable users to post if they're still on an old version of // Keep the now invalid timestamps around for a bit to enable users to post if they're still on an old version of
@ -224,3 +224,9 @@ function _create_antibot($board, $thread) {
return $antibot; return $antibot;
} }
function purge_old_antispam() {
$query = prepare('DELETE FROM ``antispam`` WHERE `expires` < UNIX_TIMESTAMP()');
$query->execute() or error(db_error());
return $query->rowCount();
}