mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-30 07:59:35 +00:00
Backup code cleanup and fixes daily backup not executed (#7397)
This commit is contained in:
parent
d51e8e86cf
commit
4cacf75c9e
5 changed files with 195 additions and 235 deletions
|
|
@ -1,7 +1,6 @@
|
|||
--
|
||||
-- (C) 2013-23 - ntop.org
|
||||
--
|
||||
|
||||
local dirs = ntop.getDirs()
|
||||
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
|
||||
package.path = dirs.installdir .. "/scripts/lua/modules/system_config/?.lua;" .. package.path
|
||||
|
|
@ -16,22 +15,17 @@ local backup_config = require("backup_config")
|
|||
local download = _GET["download"]
|
||||
local epoch = _GET["epoch"]
|
||||
|
||||
local resp = backup_config.export_backup(epoch)
|
||||
local succ, rsp = backup_config.export_backup(epoch)
|
||||
|
||||
if ( resp == -1 ) then
|
||||
rest_utils.answer( rest_utils.consts.err.bad_content)
|
||||
end
|
||||
|
||||
if download and not isEmptyString(download) and download == "true" then
|
||||
-- Download as file
|
||||
|
||||
sendHTTPContentTypeHeader('application/json', 'attachment; filename="configuration.json"')
|
||||
print(resp)
|
||||
else
|
||||
|
||||
-- Send as REST answer
|
||||
rest_utils.answer(rest_utils.consts.success.ok, resp)
|
||||
if (not succ) then
|
||||
rest_utils.answer(rest_utils.consts.err.bad_content)
|
||||
end
|
||||
|
||||
|
||||
-- Download the file
|
||||
if download then
|
||||
sendHTTPContentTypeHeader('application/json', 'attachment; filename="configuration.json"')
|
||||
print(rsp)
|
||||
else
|
||||
rest_utils.answer(rest_utils.consts.success.ok, rsp)
|
||||
end
|
||||
-- ##############################################
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue