forked from leftypol/leftypol
functions.php: skip ban deletion on auto_maintenance disabled
This commit is contained in:
parent
cc1b59127d
commit
4b03672f77
1 changed files with 16 additions and 11 deletions
|
@ -880,7 +880,9 @@ function checkBan($board = false) {
|
||||||
|
|
||||||
foreach ($bans as &$ban) {
|
foreach ($bans as &$ban) {
|
||||||
if ($ban['expires'] && $ban['expires'] < time()) {
|
if ($ban['expires'] && $ban['expires'] < time()) {
|
||||||
Bans::delete($ban['id']);
|
if ($config['auto_maintenance']) {
|
||||||
|
Bans::delete($ban['id']);
|
||||||
|
}
|
||||||
if ($config['require_ban_view'] && !$ban['seen']) {
|
if ($config['require_ban_view'] && !$ban['seen']) {
|
||||||
if (!isset($_POST['json_response'])) {
|
if (!isset($_POST['json_response'])) {
|
||||||
displayBan($ban);
|
displayBan($ban);
|
||||||
|
@ -900,17 +902,20 @@ function checkBan($board = false) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// I'm not sure where else to put this. It doesn't really matter where; it just needs to be called every
|
if ($config['auto_maintenance']) {
|
||||||
// now and then to keep the ban list tidy.
|
// I'm not sure where else to put this. It doesn't really matter where; it just needs to be called every
|
||||||
if ($config['cache']['enabled'] && $last_time_purged = cache::get('purged_bans_last')) {
|
// now and then to keep the ban list tidy.
|
||||||
if (time() - $last_time_purged < $config['purge_bans'] )
|
if ($config['cache']['enabled']) {
|
||||||
return;
|
$last_time_purged = cache::get('purged_bans_last');
|
||||||
|
if ($last_time_purged !== false && time() - $last_time_purged > $config['purge_bans']) {
|
||||||
|
Bans::purge($config['require_ban_view']);
|
||||||
|
cache::set('purged_bans_last', time());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Purge every time.
|
||||||
|
Bans::purge($config['require_ban_view']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Bans::purge($config['require_ban_view']);
|
|
||||||
|
|
||||||
if ($config['cache']['enabled'])
|
|
||||||
cache::set('purged_bans_last', time());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function threadLocked($id) {
|
function threadLocked($id) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue