mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 07:29:32 +00:00
Fix possibly nil day in delete_data_utils.harvestDateBasedDirTree
This commit is contained in:
parent
1975d68e91
commit
0065eb9cd4
1 changed files with 11 additions and 9 deletions
|
|
@ -513,17 +513,19 @@ function delete_data_utils.harvestDateBasedDirTree(dir, retention, now)
|
|||
local tot_days = 0
|
||||
|
||||
for day in pairs(ntop.readdir(month_path) or {}) do
|
||||
local tstamp = os.time({day=tonumber(day), month=tonumber(month), year=tonumber(year), hour=0, min=0, sec=0})
|
||||
local days_diff = (now - tstamp) / 86400
|
||||
if(tonumber(day) ~= nil) then
|
||||
local tstamp = os.time({day=tonumber(day), month=tonumber(month), year=tonumber(year), hour=0, min=0, sec=0})
|
||||
local days_diff = (now - tstamp) / 86400
|
||||
|
||||
if(days_diff > retention) then
|
||||
local day_path = os_utils.fixPath(month_path .. "/" .. day)
|
||||
--tprint(os.date('PURGE %Y-%m-%d %H:%M:%S', tstamp))
|
||||
ntop.rmdir(day_path)
|
||||
num_deleted_days = num_deleted_days + 1
|
||||
if(days_diff > retention) then
|
||||
local day_path = os_utils.fixPath(month_path .. "/" .. day)
|
||||
--tprint(os.date('PURGE %Y-%m-%d %H:%M:%S', tstamp))
|
||||
ntop.rmdir(day_path)
|
||||
num_deleted_days = num_deleted_days + 1
|
||||
end
|
||||
|
||||
tot_days = tot_days + 1
|
||||
end
|
||||
|
||||
tot_days = tot_days + 1
|
||||
end
|
||||
|
||||
if num_deleted_days == tot_days then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue