From 2e96c40d6232c4dad5d3ffb17281e6208882ded5 Mon Sep 17 00:00:00 2001 From: Andrew Date: Mon, 31 Jan 2022 17:58:02 -0500 Subject: [PATCH] Make audit entries configurable --- app/classes/models/management.py | 7 ++++--- app/config/config.json | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/classes/models/management.py b/app/classes/models/management.py index ea2d8487..6e805e71 100644 --- a/app/classes/models/management.py +++ b/app/classes/models/management.py @@ -191,11 +191,11 @@ class helpers_management: Audit_Log.log_msg: audit_msg, Audit_Log.source_ip: source_ip }).execute() - #todo make this user configurable #deletes records when they're more than 100 ordered = Audit_Log.select().order_by(+Audit_Log.created) for item in ordered: - if Audit_Log.select().count() > 300: + #configurable through app/config/config.json + if Audit_Log.select().count() > helper.get_setting('max_audit_entries'): Audit_Log.delete().where(Audit_Log.audit_id == item.audit_id).execute() else: return @@ -212,7 +212,8 @@ class helpers_management: #deletes records when they're more than 100 ordered = Audit_Log.select().order_by(+Audit_Log.created) for item in ordered: - if Audit_Log.select().count() > 300: + #configurable through app/config/config.json + if Audit_Log.select().count() > helper.get_setting('max_audit_entries'): Audit_Log.delete().where(Audit_Log.audit_id == item.audit_id).execute() else: return diff --git a/app/config/config.json b/app/config/config.json index f0853518..7f3ff5f6 100644 --- a/app/config/config.json +++ b/app/config/config.json @@ -13,6 +13,7 @@ "show_contribute_link": true, "virtual_terminal_lines": 70, "max_log_lines": 700, + "max_audit_entries": 300, "keywords": ["help", "chunk"], "allow_nsfw_profile_pictures": false }