functions.php: make automated antispam puring optional

This commit is contained in:
Zankaria 2024-07-08 23:58:54 +02:00 committed by Zankaria
parent cc5e96eb9d
commit e5bbdb9d28

View File

@ -1612,13 +1612,19 @@ function checkMute() {
} }
} }
function purge_old_antispam() {
$query = prepare('DELETE FROM ``antispam`` WHERE `expires` < UNIX_TIMESTAMP()');
$query->execute() or error(db_error());
return $query->rowCount();
}
function _create_antibot($board, $thread) { function _create_antibot($board, $thread) {
global $config, $purged_old_antispam; global $config, $purged_old_antispam;
$antibot = new AntiBot([$board, $thread]); $antibot = new AntiBot([$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()); query('DELETE FROM ``antispam`` WHERE `expires` < UNIX_TIMESTAMP()') or error(db_error());
} }