mirror of
https://github.com/vichan-devel/vichan.git
synced 2024-11-28 01:10:51 +01:00
bans.php: make the purge configurable
This commit is contained in:
parent
75714505a0
commit
cbaf19cb7a
17
inc/bans.php
17
inc/bans.php
@ -342,9 +342,20 @@ class Bans {
|
||||
rebuildThemes('bans');
|
||||
}
|
||||
|
||||
static public function purge() {
|
||||
$query = query("DELETE FROM ``bans`` WHERE `expires` IS NOT NULL AND `expires` < " . time() . " AND `seen` = 1") or error(db_error());
|
||||
rebuildThemes('bans');
|
||||
static public function purge($require_seen) {
|
||||
if ($require_seen) {
|
||||
$query = prepare("DELETE FROM ``bans`` WHERE `expires` IS NOT NULL AND `expires` < :curr_time AND `seen` = 1");
|
||||
} else {
|
||||
$query = prepare("DELETE FROM ``bans`` WHERE `expires` IS NOT NULL AND `expires` < :curr_time");
|
||||
}
|
||||
$query->bindValue(':curr_time', time());
|
||||
$query->execute() or error(db_error($query));
|
||||
|
||||
$affected = $query->rowCount();
|
||||
if ($affected > 0) {
|
||||
rebuildThemes('bans');
|
||||
}
|
||||
return $affected;
|
||||
}
|
||||
|
||||
static public function delete($ban_id, $modlog = false, $boards = false, $dont_rebuild = false) {
|
||||
|
@ -907,7 +907,7 @@ function checkBan($board = false) {
|
||||
return;
|
||||
}
|
||||
|
||||
Bans::purge();
|
||||
Bans::purge($config['require_ban_view']);
|
||||
|
||||
if ($config['cache']['enabled'])
|
||||
cache::set('purged_bans_last', time());
|
||||
|
Loading…
Reference in New Issue
Block a user