1 module("ffluci.controller.admin.uci", package.seeall)
3 -- This function has a higher priority than the admin_uci/apply template
4 function action_apply()
5 local changes = ffluci.model.uci.changes()
11 -- Collect files to be applied
12 for i, line in ipairs(ffluci.util.split(changes)) do
13 local r = line:match("^[^.]+")
20 ffluci.model.uci.commit()
22 -- Search for post-commit commands
23 if ffluci.config.uci_oncommit then
24 for k, v in pairs(apply) do
25 local cmd = ffluci.config.uci_oncommit[k]
27 output = output .. ffluci.util.exec(cmd)
33 ffluci.template.render("admin_uci/apply", {changes=changes, output=output})
37 function action_revert()
38 local changes = ffluci.model.uci.changes()
42 -- Collect files to be reverted
43 for i, line in ipairs(ffluci.util.split(changes)) do
44 local r = line:match("^[^.]+")
51 for k, v in pairs(revert) do
52 ffluci.model.uci.revert(k)
56 ffluci.template.render("admin_uci/revert", {changes=changes})