summaryrefslogtreecommitdiffhomepage
path: root/module
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-05-06 16:31:16 +0000
committerSteven Barth <steven@midlink.org>2008-05-06 16:31:16 +0000
commit21bd8ca76deec06b8e4f4dc3bc2ea75c7f9c3260 (patch)
tree57597996fb2ddc0a9c08bc35d6e2d747a8301baf /module
parent4ce666845f2a09bdba77448617edf4f85b1f0f80 (diff)
* Fixed apply function
* Fixed a few typos
Diffstat (limited to 'module')
-rw-r--r--module/admin-core/src/controller/admin/uci.lua24
1 files changed, 14 insertions, 10 deletions
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