mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 07:29:32 +00:00
Add supprot for DB query presets (WIP) (#6037)
This commit is contained in:
parent
663f139dc3
commit
03addeeca0
9 changed files with 290 additions and 76 deletions
|
|
@ -4,9 +4,39 @@
|
|||
|
||||
local file_utils = {}
|
||||
local os_utils = require("os_utils")
|
||||
local json = require "dkjson"
|
||||
|
||||
-- ##############################################
|
||||
|
||||
function file_utils.read_file(file_path)
|
||||
local content = nil
|
||||
|
||||
local file = io.open(file_path, "r")
|
||||
|
||||
if file ~= nil then
|
||||
content = file:read("*all")
|
||||
file:close()
|
||||
end
|
||||
|
||||
return content
|
||||
end
|
||||
|
||||
-- ##############################################
|
||||
|
||||
function file_utils.read_json_file(file_path)
|
||||
local json_content = nil
|
||||
|
||||
local content = file_utils.read_file(file_path)
|
||||
|
||||
if content ~= nil then
|
||||
json_content = json.decode(content)
|
||||
end
|
||||
|
||||
return json_content
|
||||
end
|
||||
|
||||
-- ##############################################
|
||||
|
||||
function file_utils.copy_file(fname, src_path, dst_path)
|
||||
local src
|
||||
local dst
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue