1 module("ffluci.controller.admin.uci", package.seeall)
5 -- This function has a higher priority than the admin_uci/apply template
6 function action_apply()
7 local changes = ffluci.model.uci.changes()
13 -- Collect files to be applied
14 for i, line in ipairs(ffluci.util.split(changes)) do
15 local r = line:match("^-?([^.]+)")
22 ffluci.model.uci.commit()
24 -- Search for post-commit commands
25 if ffluci.config.uci_oncommit then
26 for k, v in pairs(apply) do
27 local cmd = ffluci.config.uci_oncommit[k]
29 output = output .. cmd .. ":" .. ffluci.sys.exec(cmd)
35 ffluci.template.render("admin_uci/apply", {changes=changes, output=output})
39 function action_revert()
40 local changes = ffluci.model.uci.changes()
44 -- Collect files to be reverted
45 for i, line in ipairs(ffluci.util.split(changes)) do
46 local r = line:match("^-?([^.]+)")
53 for k, v in pairs(revert) do
54 ffluci.model.uci.revert(k)
58 ffluci.template.render("admin_uci/revert", {changes=changes})