mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-28 23:19:33 +00:00
Makes all ntopng.pref keys persistent to file
This commit is contained in:
parent
e22c6ab0e4
commit
43265da8b0
10 changed files with 54 additions and 418 deletions
|
|
@ -15,11 +15,16 @@ local prefs_dump_utils = {}
|
|||
function prefs_dump_utils.savePrefsToDisk()
|
||||
local dirs = ntop.getDirs()
|
||||
local where = os_utils.fixPath(dirs.workingdir.."/runtimeprefs.json")
|
||||
local keys = ntop.getKeysCache("ntopng.prefs.*")
|
||||
|
||||
local patterns = {"ntopng.prefs.*", "ntopng.user.*"}
|
||||
|
||||
local out = {}
|
||||
for k in pairs(keys or {}) do
|
||||
out[k] = ntop.dumpCache(k)
|
||||
for _, pattern in pairs(patterns) do
|
||||
local keys = ntop.getKeysCache(pattern)
|
||||
|
||||
for k in pairs(keys or {}) do
|
||||
out[k] = ntop.dumpCache(k)
|
||||
end
|
||||
end
|
||||
|
||||
local json = require("dkjson")
|
||||
|
|
@ -45,7 +50,7 @@ function prefs_dump_utils.readPrefsFromDisk()
|
|||
local restore = json.decode(dump, 1, nil)
|
||||
|
||||
for k,v in pairs(restore or {}) do
|
||||
-- print(k.."\n")
|
||||
--print(k.."\n")
|
||||
ntop.delCache(k)
|
||||
ntop.restoreCache(k,v)
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue