'Restore any previous valid bans from the database.'

def restoreCurrentBans(self):

    try:
        if (self.database is not None):
            forbantime = None
            if (not self.getBanTimeExtra('increment')):
                forbantime = self.actions.getBanTime()
            for ticket in self.database.getCurrentBans(jail=self, forbantime=forbantime):
                try:
                    if self.filter.inIgnoreIPList(ticket.getIP(), log_ignore=True):
                        continue
                    ticket.restored = True
                    btm = ticket.getBanTime(forbantime)
                    diftm = (MyTime.time() - ticket.getTime())
                    if ((btm != (-1)) and (diftm > 0)):
                        btm -= diftm
                    if ((btm != (-1)) and (btm <= 0)):
                        continue
                    self.putFailTicket(ticket)
                except Exception as e:
                    logSys.error('Restore    ticket    failed:    %s', e, exc_info=(logSys.getEffectiveLevel() <= logging.DEBUG))
    except Exception as e:
        logSys.error('Restore    bans    failed:    %s', e, exc_info=(logSys.getEffectiveLevel() <= logging.DEBUG))
