summaryrefslogtreecommitdiffstats
path: root/weblog-model.lua
diff options
context:
space:
mode:
Diffstat (limited to 'weblog-model.lua')
-rw-r--r--weblog-model.lua8
1 files changed, 6 insertions, 2 deletions
diff --git a/weblog-model.lua b/weblog-model.lua
index 619a538..ae2fa60 100644
--- a/weblog-model.lua
+++ b/weblog-model.lua
@@ -275,7 +275,7 @@ local groompublogs = function()
local now = os.time()
local temp = os.date("%Y-%m-%d %H:%M:%S", now - purgedays*86400)
- logme("Purgedate is " .. temp .. ". Nothing will exist in pubweblog beyond purgedate.")
+ logme("Purgedate is " .. temp .. ". Nothing will exist in pubweblog from before purgedate.")
-- Move flagged records to histoy and then purge anything older than purgedate
sql = "Insert into pubweblog_history select * from pubweblog where logdatetime < '" .. temp .."' and (badyesno > 0 or deniedyesno > 0 or bypassyesno > 0 or selected = 'true')"
@@ -284,7 +284,11 @@ local groompublogs = function()
sql = "Delete from pubweblog where logdatetime < '" .. temp .."'"
res = assert (con:execute(sql))
- logme("Deleted " .. res .. " old records to from pubweblog")
+ logme("Deleted " .. res .. " old records from pubweblog")
+
+ sql = "delete from pubweblog_history where logdatetime < (now() - INTERVAL '1 year')"
+ res = assert (con:execute(sql))
+ logme("Deleted " .. res .. " old records from pubweblog_history")
end
local generatewhereclause = function(clientuserid, starttime, endtime, clientip, badyesno, deniedyesno, bypassyesno, score, urisearch, selected)