From: Steven Barth Date: Tue, 6 May 2008 16:31:16 +0000 (+0000) Subject: * Fixed apply function X-Git-Tag: 0.8.0~1071 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=21bd8ca76deec06b8e4f4dc3bc2ea75c7f9c3260;p=oweals%2Fluci.git * Fixed apply function * Fixed a few typos --- diff --git a/core/src/ffluci/sgi/haserl.lua b/core/src/ffluci/sgi/haserl.lua index 041cffc70..76dc3854a 100644 --- a/core/src/ffluci/sgi/haserl.lua +++ b/core/src/ffluci/sgi/haserl.lua @@ -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 diff --git a/core/src/ffluci/sgi/webuci.lua b/core/src/ffluci/sgi/webuci.lua index 05348e44d..297780295 100644 --- a/core/src/ffluci/sgi/webuci.lua +++ b/core/src/ffluci/sgi/webuci.lua @@ -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 diff --git a/module/admin-core/src/controller/admin/uci.lua b/module/admin-core/src/controller/admin/uci.lua index 5c34e56d3..cb4a95ba5 100644 --- a/module/admin-core/src/controller/admin/uci.lua +++ b/module/admin-core/src/controller/admin/uci.lua @@ -8,25 +8,29 @@ 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 - output = output .. cmd .. ":" .. ffluci.sys.exec(cmd) .. "\n" - end - end + for cmd, i in pairs(run) do + output = output .. cmd .. ":" .. ffluci.sys.exec(cmd) .. "\n" end end