diff options
Diffstat (limited to 'modules/admin-mini')
5 files changed, 24 insertions, 27 deletions
diff --git a/modules/admin-mini/luasrc/controller/mini/system.lua b/modules/admin-mini/luasrc/controller/mini/system.lua index be6cdb6b5..c3910a302 100644 --- a/modules/admin-mini/luasrc/controller/mini/system.lua +++ b/modules/admin-mini/luasrc/controller/mini/system.lua @@ -113,7 +113,7 @@ end function _keep_pattern() local kpattern = "" - local files = luci.model.uci.get_all("luci", "flash_keep") + local files = luci.model.uci.cursor():get_all("luci", "flash_keep") if files then kpattern = "" for k,v in pairs(files) do diff --git a/modules/admin-mini/luasrc/controller/mini/uci.lua b/modules/admin-mini/luasrc/controller/mini/uci.lua index 9b57fe31a..31e04051b 100644 --- a/modules/admin-mini/luasrc/controller/mini/uci.lua +++ b/modules/admin-mini/luasrc/controller/mini/uci.lua @@ -48,12 +48,13 @@ function convert_changes(changes) end function action_changes() - local changes = convert_changes(luci.model.uci.changes()) + local changes = convert_changes(luci.model.uci.cursor():changes()) luci.template.render("mini/uci_changes", {changes=changes}) end function action_apply() - local changes = luci.model.uci.changes() + local uci = luci.model.uci.cursor() + local changes = uci:changes() local output = "" if changes then @@ -63,9 +64,9 @@ function action_apply() -- 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) + uci:load(r) + uci:commit(r) + uci:unload(r) if luci.config.uci_oncommit and luci.config.uci_oncommit[r] then run[luci.config.uci_oncommit[r]] = true end @@ -84,15 +85,16 @@ end function action_revert() - local changes = luci.model.uci.changes() + local uci = luci.model.uci.cursor() + local changes = uci:changes() if changes then local revert = {} -- Collect files to be reverted for r, tbl in pairs(changes) do - luci.model.uci.load_config(r) - luci.model.uci.revert(r) - luci.model.uci.unload(r) + uci:load(r) + uci:revert(r) + uci:unload(r) end end diff --git a/modules/admin-mini/luasrc/model/cbi/mini/dhcp.lua b/modules/admin-mini/luasrc/model/cbi/mini/dhcp.lua index 85b2c86aa..e01890f0a 100644 --- a/modules/admin-mini/luasrc/model/cbi/mini/dhcp.lua +++ b/modules/admin-mini/luasrc/model/cbi/mini/dhcp.lua @@ -58,7 +58,7 @@ time.rmempty = true m2 = Map("luci_ethers", translate("dhcp_leases")) local leasefn, leasefp, leases -luci.model.uci.foreach("dhcp", "dnsmasq", +luci.model.uci.cursor():foreach("dhcp", "dnsmasq", function(section) leasefn = section.leasefile end diff --git a/modules/admin-mini/luasrc/model/cbi/mini/network.lua b/modules/admin-mini/luasrc/model/cbi/mini/network.lua index 692f7c456..4289f35a9 100644 --- a/modules/admin-mini/luasrc/model/cbi/mini/network.lua +++ b/modules/admin-mini/luasrc/model/cbi/mini/network.lua @@ -15,9 +15,7 @@ $Id$ require("luci.tools.webadmin") require("luci.sys") -luci.model.uci.load_state("network") -local network = luci.model.uci.get_all("network") -luci.model.uci.unload("network") +local network = luci.model.uci.cursor_state():get_all("network") local netstat = luci.sys.net.deviceinfo() local ifaces = {} diff --git a/modules/admin-mini/luasrc/model/cbi/mini/wifi.lua b/modules/admin-mini/luasrc/model/cbi/mini/wifi.lua index 95407be85..64e7400ca 100644 --- a/modules/admin-mini/luasrc/model/cbi/mini/wifi.lua +++ b/modules/admin-mini/luasrc/model/cbi/mini/wifi.lua @@ -15,10 +15,7 @@ $Id$ -- Data init -- -luci.model.uci.load_state("wireless") -local wireless = luci.model.uci.get_all("wireless") -luci.model.uci.unload("wireless") - +local wireless = luci.model.uci.cursor_state():get_all("wireless") local wifidata = luci.sys.wifi.getiwconfig() local ifaces = {} @@ -148,7 +145,7 @@ s.anonymous = true s:option(Value, "ssid", translate("a_w_netid")).maxlength = 32 local devs = {} -luci.model.uci.foreach("wireless", "wifi-device", +luci.model.uci.cursor():foreach("wireless", "wifi-device", function (section) table.insert(devs, section[".name"]) end) @@ -167,21 +164,21 @@ mode:value("sta", translate("m_w_client")) function mode.write(self, section, value) if value == "sta" then -- ToDo: Move this away - if not luci.model.uci.get("network", "wan") then - luci.model.uci.set("network", "wan", "proto", "none") - luci.model.uci.set("network", "wan", "ifname", " ") + if not m.uci:get("network", "wan") then + m.uci:set("network", "wan", "proto", "none") + m.uci:set("network", "wan", "ifname", " ") end - local oldif = luci.model.uci.get("network", "wan", "ifname") + local oldif = m.uci:get("network", "wan", "ifname") if oldif and oldif ~= " " then - luci.model.uci.set("network", "wan", "_ifname", oldif) + m.uci:set("network", "wan", "_ifname", oldif) end - luci.model.uci.set("network", "wan", "ifname", " ") + m.uci:set("network", "wan", "ifname", " ") self.map:set(section, "network", "wan") else - if luci.model.uci.get("network", "wan", "_ifname") then - luci.model.uci.set("network", "wan", "ifname", luci.model.uci.get("network", "wan", "_ifname")) + if m.uci:get("network", "wan", "_ifname") then + m.uci:set("network", "wan", "ifname", m.uci:get("network", "wan", "_ifname")) end self.map:set(section, "network", "lan") end |