forked from leftypol/leftypol
anti-bot.php: make automated antispam puring optional
This commit is contained in:
parent
6cf574a998
commit
7613eda52b
1 changed files with 8 additions and 2 deletions
|
@ -196,9 +196,9 @@ function _create_antibot($board, $thread) {
|
|||
$antibot = new AntiBot(array($board, $thread));
|
||||
|
||||
// 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;
|
||||
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
|
||||
|
@ -224,3 +224,9 @@ function _create_antibot($board, $thread) {
|
|||
|
||||
return $antibot;
|
||||
}
|
||||
|
||||
function purge_old_antispam() {
|
||||
$query = prepare('DELETE FROM ``antispam`` WHERE `expires` < UNIX_TIMESTAMP()');
|
||||
$query->execute() or error(db_error());
|
||||
return $query->rowCount();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue