* Fixed apply function
* Fixed a few typos
This commit is contained in:
parent
4ce666845f
commit
21bd8ca76d
3 changed files with 16 additions and 12 deletions
|
@ -31,7 +31,7 @@ FORM = FORM or {}
|
|||
-- HTTP interface
|
||||
|
||||
-- Returns a table of all COOKIE, GET and POST Parameters
|
||||
function ffluci.http.formvalues(prefix)
|
||||
function ffluci.http.formvalues()
|
||||
return FORM
|
||||
end
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ module("ffluci.sgi.webuci", package.seeall)
|
|||
-- HTTP interface
|
||||
|
||||
-- Returns a table of all COOKIE, GET and POST Parameters
|
||||
function ffluci.http.formvalues(prefix)
|
||||
function ffluci.http.formvalues()
|
||||
return webuci.vars
|
||||
end
|
||||
|
||||
|
|
|
@ -8,27 +8,31 @@ function action_apply()
|
|||
local output = ""
|
||||
|
||||
if changes then
|
||||
local apply = {}
|
||||
local com = {}
|
||||
local run = {}
|
||||
|
||||
-- Collect files to be applied and commit changes
|
||||
for i, line in ipairs(ffluci.util.split(changes)) do
|
||||
local r = line:match("^-?([^.]+)")
|
||||
if r and not ffluci.util.contains(apply, ffluci.config.uci_oncommit[r]) then
|
||||
table.insert(apply, ffluci.config.uci_oncommit[r])
|
||||
ffluci.model.uci.commit(r)
|
||||
if r then
|
||||
com[r] = true
|
||||
|
||||
if ffluci.config.uci_oncommit and ffluci.config.uci_oncommit[r] then
|
||||
run[ffluci.config.uci_oncommit[r]] = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Apply
|
||||
for config, i in pairs(com) do
|
||||
ffluci.model.uci.commit(config)
|
||||
end
|
||||
|
||||
-- Search for post-commit commands
|
||||
if ffluci.config.uci_oncommit then
|
||||
for i, cmd in ipairs(apply) do
|
||||
if cmd then
|
||||
for cmd, i in pairs(run) do
|
||||
output = output .. cmd .. ":" .. ffluci.sys.exec(cmd) .. "\n"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
ffluci.template.render("admin_uci/apply", {changes=changes, output=output})
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue