- local changes = luci.model.uci.changes()
- local output = ""
-
- if changes then
- local com = {}
- local run = {}
-
- -- Collect files to be applied and commit changes
- for r, tbl in pairs(changes) do
- if r then
- luci.model.uci.load_config(r)
- luci.model.uci.commit(r)
- luci.model.uci.unload(r)
- if luci.config.uci_oncommit and luci.config.uci_oncommit[r] then
- run[luci.config.uci_oncommit[r]] = true
- end
- end
- end
-
- -- Search for post-commit commands
- for cmd, i in pairs(run) do
- output = output .. cmd .. ":" .. luci.util.exec(cmd) .. "\n"
- end
+ local path = luci.dispatcher.context.path
+ local uci = luci.model.uci.cursor()
+ local changes = uci:changes()
+ local reload = {}
+
+ -- Collect files to be applied and commit changes
+ for r, tbl in pairs(changes) do
+ table.insert(reload, r)
+ uci:load(r)
+ uci:commit(r)
+ uci:unload(r)