mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 23:49:33 +00:00
Fixes various issues
This commit is contained in:
parent
f640be21d5
commit
d5097ad8ef
7 changed files with 741 additions and 713 deletions
|
|
@ -111,8 +111,11 @@ function backup_config.fs_save_backup(backup_time_key, backup, to_ignore)
|
|||
|
||||
-- get last backup
|
||||
local handle = io.open(base_dir..path_separator..last_b_name, "r")
|
||||
local backup_string = handle:read("*a")
|
||||
handle:close()
|
||||
local backup_string
|
||||
if handle then
|
||||
backup_string = handle:read("*a")
|
||||
handle:close()
|
||||
end
|
||||
|
||||
if (num_backups >= 7) then
|
||||
-- remove here the first_b_name
|
||||
|
|
@ -141,11 +144,13 @@ function backup_config.fs_save_backup(backup_time_key, backup, to_ignore)
|
|||
local backup_j_string = json.encode(backup)
|
||||
local writer = io.open(base_dir..path_separator..key.."_config.json","w")
|
||||
|
||||
if debugger then
|
||||
traceError(TRACE_DEBUG, TRACE_CONSOLE, "SAVING BACKUP: "..base_dir..path_separator..key.."_config.json")
|
||||
-- In case there is some error with permissions
|
||||
if writer then
|
||||
writer:write(backup_j_string)
|
||||
writer:close()
|
||||
else
|
||||
traceError(TRACE_WARNING, TRACE_CONSOLE, "Unable to save configuration backup: "..base_dir..path_separator..key.."_config.json")
|
||||
end
|
||||
writer:write(backup_j_string)
|
||||
writer:close()
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue