Commit 570fb191 authored by Ted Trask's avatar Ted Trask

Purge the pubweblog_history table after one year

parent 23008697
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment