mirror of https://github.com/fail2ban/fail2ban
remove affected check, to delete jails always (pass testPurge)
parent
99c9cbf470
commit
f492aa7ac9
|
@ -602,18 +602,14 @@ class Fail2BanDb(object):
|
||||||
"DELETE FROM bips WHERE timeofban < ? and bantime != -1 and (timeofban + (bantime * ?)) < ?",
|
"DELETE FROM bips WHERE timeofban < ? and bantime != -1 and (timeofban + (bantime * ?)) < ?",
|
||||||
(int(MyTime.time()) - self._purgeAge, self._outDatedFactor, int(MyTime.time()) - self._purgeAge))
|
(int(MyTime.time()) - self._purgeAge, self._outDatedFactor, int(MyTime.time()) - self._purgeAge))
|
||||||
|
|
||||||
#@commitandrollback
|
@commitandrollback
|
||||||
def purge(self):
|
def purge(self, cur):
|
||||||
"""Purge old bans, jails and log files from database.
|
"""Purge old bans, jails and log files from database.
|
||||||
"""
|
"""
|
||||||
cur = self._db.cursor()
|
|
||||||
self._bansMergedCache = {}
|
self._bansMergedCache = {}
|
||||||
cur.execute(
|
cur.execute(
|
||||||
"DELETE FROM bans WHERE timeofban < ?",
|
"DELETE FROM bans WHERE timeofban < ?",
|
||||||
(MyTime.time() - self._purgeAge, ))
|
(MyTime.time() - self._purgeAge, ))
|
||||||
affected = cur.rowcount
|
|
||||||
self._purge_bips(cur)
|
self._purge_bips(cur)
|
||||||
affected += cur.rowcount
|
|
||||||
if affected:
|
|
||||||
self._cleanjails(cur)
|
self._cleanjails(cur)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue