diff options
author | Steven Barth <steven@midlink.org> | 2008-08-26 23:00:44 +0000 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2008-08-26 23:00:44 +0000 |
commit | 91ba7c42f5b45614c9f4c803d09399f08a8e27b1 (patch) | |
tree | 21d1e1d67b3bee82eb123c0c5dbb274f2fcb6b59 /modules | |
parent | 43b3217e5595acc91ff6d7614a5c21c88696fbcc (diff) |
UCI API changes
Diffstat (limited to 'modules')
20 files changed, 104 insertions, 167 deletions
diff --git a/modules/admin-core/luasrc/tools/webadmin.lua b/modules/admin-core/luasrc/tools/webadmin.lua index 1e3d9e002..f7eddd800 100644 --- a/modules/admin-core/luasrc/tools/webadmin.lua +++ b/modules/admin-core/luasrc/tools/webadmin.lua @@ -14,7 +14,7 @@ $Id$ ]]-- module("luci.tools.webadmin", package.seeall) -require("luci.model.uci") +local uci = require("luci.model.uci") require("luci.sys") require("luci.ip") @@ -59,11 +59,12 @@ function date_format(secs) end function network_get_addresses(net) - luci.model.uci.load_state("network") + local state = uci.cursor_state() + state:load("network") local addr = {} - local ipv4 = luci.model.uci.get("network", net, "ipaddr") - local mav4 = luci.model.uci.get("network", net, "netmask") - local ipv6 = luci.model.uci.get("network", net, "ip6addr") + local ipv4 = state:get("network", net, "ipaddr") + local mav4 = state:get("network", net, "netmask") + local ipv6 = state:get("network", net, "ip6addr") if ipv4 and mav4 then ipv4 = luci.ip.IPv4(ipv4, mav4) @@ -77,7 +78,7 @@ function network_get_addresses(net) table.insert(addr, ipv6) end - luci.model.uci.foreach("network", "alias", + state:foreach("network", "alias", function (section) if section.interface == net then if section.ipaddr and section.netmask then @@ -99,7 +100,7 @@ function network_get_addresses(net) end function cbi_add_networks(field) - luci.model.uci.foreach("network", "interface", + uci.cursor():foreach("network", "interface", function (section) if section[".name"] ~= "loopback" then field:value(section[".name"]) @@ -116,13 +117,14 @@ function cbi_add_knownips(field) end function network_get_zones(net) - if not luci.model.uci.load_state("firewall") then + local state = uci.cursor_state() + if not state:load("firewall") then return nil end local zones = {} - luci.model.uci.foreach("firewall", "zone", + state:foreach("firewall", "zone", function (section) local znet = section.network or section.name if luci.util.contains(luci.util.split(znet, " "), net) then @@ -137,7 +139,7 @@ end function firewall_find_zone(name) local find - luci.model.uci.foreach("firewall", "zone", + luci.model.uci.cursor():foreach("firewall", "zone", function (section) if section.name == name then find = section[".name"] @@ -149,12 +151,13 @@ function firewall_find_zone(name) end function iface_get_network(iface) - luci.model.uci.load_state("network") + local state = uci.cursor_state() + state:load("network") local net - luci.model.uci.foreach("network", "interface", + state:foreach("network", "interface", function (section) - local ifname = luci.model.uci.get( + local ifname = state:get( "network", section[".name"], "ifname" ) diff --git a/modules/admin-full/luasrc/controller/admin/network.lua b/modules/admin-full/luasrc/controller/admin/network.lua index 23a575852..f95b8324d 100644 --- a/modules/admin-full/luasrc/controller/admin/network.lua +++ b/modules/admin-full/luasrc/controller/admin/network.lua @@ -15,7 +15,7 @@ module("luci.controller.admin.network", package.seeall) function index() require("luci.i18n") - require("luci.model.uci") + local uci = require("luci.model.uci").cursor() local i18n = luci.i18n.translate local page = node("admin", "network") @@ -32,7 +32,7 @@ function index() page.target = form("admin_network/wireless") page.title = i18n("wifi") page.order = 15 - luci.model.uci.foreach("wireless", "wifi-device", + uci:foreach("wireless", "wifi-device", function (section) local ifc = section[".name"] entry({"admin", "network", "wireless", ifc}, @@ -49,7 +49,7 @@ function index() page.target = cbi("admin_network/network") page.title = i18n("interfaces", "Schnittstellen") page.order = 10 - luci.model.uci.foreach("network", "interface", + uci:foreach("network", "interface", function (section) local ifc = section[".name"] if ifc ~= "loopback" then diff --git a/modules/admin-full/luasrc/controller/admin/system.lua b/modules/admin-full/luasrc/controller/admin/system.lua index fdddf6b8d..6cf951a15 100644 --- a/modules/admin-full/luasrc/controller/admin/system.lua +++ b/modules/admin-full/luasrc/controller/admin/system.lua @@ -216,7 +216,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-full/luasrc/controller/admin/uci.lua b/modules/admin-full/luasrc/controller/admin/uci.lua index 5dd0aaf6e..f5a45707c 100644 --- a/modules/admin-full/luasrc/controller/admin/uci.lua +++ b/modules/admin-full/luasrc/controller/admin/uci.lua @@ -48,7 +48,7 @@ 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("admin_uci/changes", {changes=changes}) end @@ -56,6 +56,7 @@ function action_apply() local path = luci.dispatcher.context.path local changes = luci.model.uci.changes() local output = "" + local uci = luci.model.uci.cursor() if changes then local com = {} @@ -65,9 +66,9 @@ function action_apply() for r, tbl in pairs(changes) do if r then if path[#path] ~= "apply" 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) end if luci.config.uci_oncommit and luci.config.uci_oncommit[r] then run[luci.config.uci_oncommit[r]] = true @@ -87,15 +88,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-full/luasrc/model/cbi/admin_network/dhcp.lua b/modules/admin-full/luasrc/model/cbi/admin_network/dhcp.lua index af018eaa8..42b93b599 100644 --- a/modules/admin-full/luasrc/model/cbi/admin_network/dhcp.lua +++ b/modules/admin-full/luasrc/model/cbi/admin_network/dhcp.lua @@ -24,7 +24,8 @@ s.anonymous = true iface = s:option(ListValue, "interface", translate("interface")) luci.tools.webadmin.cbi_add_networks(iface) -luci.model.uci.foreach("network", "interface", +local uci = luci.model.uci.cursor() +uci:foreach("network", "interface", function (section) if section[".name"] ~= "loopback" then iface.default = iface.default or section[".name"] @@ -32,7 +33,7 @@ luci.model.uci.foreach("network", "interface", end end) -luci.model.uci.foreach("network", "alias", +uci:foreach("network", "alias", function (section) iface:value(section[".name"]) s:depends("interface", section[".name"]) diff --git a/modules/admin-full/luasrc/model/cbi/admin_network/dhcpleases.lua b/modules/admin-full/luasrc/model/cbi/admin_network/dhcpleases.lua index 3c89de31d..0b2f55a31 100644 --- a/modules/admin-full/luasrc/model/cbi/admin_network/dhcpleases.lua +++ b/modules/admin-full/luasrc/model/cbi/admin_network/dhcpleases.lua @@ -16,7 +16,7 @@ require("luci.tools.webadmin") 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-full/luasrc/model/cbi/admin_network/ifaces.lua b/modules/admin-full/luasrc/model/cbi/admin_network/ifaces.lua index 716631232..5470b8a24 100644 --- a/modules/admin-full/luasrc/model/cbi/admin_network/ifaces.lua +++ b/modules/admin-full/luasrc/model/cbi/admin_network/ifaces.lua @@ -49,8 +49,8 @@ if zones then fwzone.rmempty = true fwzone:value("", "- " .. translate("none") .. " -") fwzone:value(arg[1]) - luci.model.uci.load_config("firewall") - luci.model.uci.foreach("firewall", "zone", + m.uci:load("firewall") + m.uci:foreach("firewall", "zone", function (section) fwzone:value(section.name) end @@ -61,14 +61,14 @@ if zones then local stat if not zone then - stat = luci.model.uci.section("firewall", "zone", nil, { + stat = m.uci:section("firewall", "zone", nil, { name = value, network = section }) else - local net = luci.model.uci.get("firewall", zone, "network") + local net = m.uci:get("firewall", zone, "network") net = (net or value) .. " " .. section - stat = luci.model.uci.set("firewall", zone, "network", net) + stat = m.uci:set("firewall", zone, "network", net) end if stat then @@ -80,7 +80,7 @@ if zones then fwzone.value = table.concat(zones, ", ") end fwzone.titleref = luci.dispatcher.build_url("admin", "network", "firewall", "zones") - luci.model.uci.unload("firewall") + m.uci:unload("firewall") end ipaddr = s:option(Value, "ipaddr", translate("ipaddress")) diff --git a/modules/admin-full/luasrc/model/cbi/admin_network/network.lua b/modules/admin-full/luasrc/model/cbi/admin_network/network.lua index 3924e7c6c..c32aea891 100644 --- a/modules/admin-full/luasrc/model/cbi/admin_network/network.lua +++ b/modules/admin-full/luasrc/model/cbi/admin_network/network.lua @@ -15,11 +15,7 @@ $Id$ require("luci.sys") require("luci.tools.webadmin") -luci.model.uci.load_state("network") -local netstate = luci.model.uci.get_all("network") -luci.model.uci.unload("network") - - +local netstate = luci.model.uci.cursor_state():get_all("network") m = Map("network", translate("interfaces")) local created @@ -70,7 +66,8 @@ end ifname.titleref = luci.dispatcher.build_url("admin", "network", "vlan") -if luci.model.uci.load("firewall") then + +if luci.model.uci.cursor():load("firewall") then zone = s:option(DummyValue, "_zone", translate("zone")) zone.titleref = luci.dispatcher.build_url("admin", "network", "firewall", "zones") diff --git a/modules/admin-full/luasrc/model/cbi/admin_network/routes.lua b/modules/admin-full/luasrc/model/cbi/admin_network/routes.lua index d7b851968..aa32324e6 100644 --- a/modules/admin-full/luasrc/model/cbi/admin_network/routes.lua +++ b/modules/admin-full/luasrc/model/cbi/admin_network/routes.lua @@ -48,11 +48,6 @@ s = m:section(TypedSection, "route", translate("a_n_routes_static")) s.addremove = true s.anonymous = true -function s.render(...) - luci.model.uci.load_config("network") - TypedSection.render(...) -end - s.template = "cbi/tblsection" iface = s:option(ListValue, "interface", translate("interface")) diff --git a/modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua b/modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua index e53fb14fd..46f05a3af 100644 --- a/modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua +++ b/modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua @@ -86,12 +86,12 @@ network.combobox_manual = translate("a_w_netmanual") luci.tools.webadmin.cbi_add_networks(network) function network.write(self, section, value) - if not luci.model.uci.get("network", value) then + if not m:uci.get("network", value) then m:chain("network") - luci.model.uci.set("network", value, "interface") + m.uci:set("network", value, "interface") Value.write(self, section, value) else - if luci.model.uci.get("network", value) == "interface" then + if m.uci:get("network", value) == "interface" then Value.write(self, section, value) end end diff --git a/modules/admin-full/luasrc/model/cbi/admin_network/wireless.lua b/modules/admin-full/luasrc/model/cbi/admin_network/wireless.lua index 4c7794db9..4f19f4e2c 100644 --- a/modules/admin-full/luasrc/model/cbi/admin_network/wireless.lua +++ b/modules/admin-full/luasrc/model/cbi/admin_network/wireless.lua @@ -15,10 +15,7 @@ $Id$ require("luci.sys") require("luci.tools.webadmin") -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 = {} @@ -123,9 +120,10 @@ for k, v in pairs(wireless) do end function create.write(self, section, value) - luci.model.uci.load_config("wireless") - luci.model.uci.section("wireless", "wifi-iface", nil, {device=value}) - luci.model.uci.save_config("wireless") + local uci = luci.model.uci.cursor() + uci:load("wireless") + uci:section("wireless", "wifi-iface", nil, {device=value}) + uci:save("wireless") luci.http.redirect(luci.http.getenv("REQUEST_URI") .. "/" .. value) end 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 diff --git a/modules/freifunk/luasrc/controller/freifunk/luciinfo.lua b/modules/freifunk/luasrc/controller/freifunk/luciinfo.lua deleted file mode 100644 index 5ddb791fe..000000000 --- a/modules/freifunk/luasrc/controller/freifunk/luciinfo.lua +++ /dev/null @@ -1,57 +0,0 @@ ---[[ -LuCI - Lua Configuration Interface - -Copyright 2008 Steven Barth <steven@midlink.org> - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -$Id$ -]]-- -module("luci.controller.freifunk.luciinfo", package.seeall) - -function index() - node("freifunk", "luciinfo").target = call("action_index") -end - -function action_index() - local uci = luci.model.uci - luci.http.prepare_content("text/plain") - - -- General - luci.http.write("luciinfo.api=1\n") - luci.http.write("luciinfo.version=" .. tostring(require("luci").__version__) .. "\n") - - -- Sysinfo - local s, m, r = luci.sys.sysinfo() - local dr = luci.sys.net.defaultroute() - dr = dr and luci.ip.Hex(dr.Gateway, 32, luci.ip.FAMILY_INET4):string() - local l1, l5, l15 = luci.sys.loadavg() - - luci.http.write("sysinfo.system=" .. sanitize(s) .. "\n") - luci.http.write("sysinfo.cpu=" .. sanitize(m) .. "\n") - luci.http.write("sysinfo.ram=" .. sanitize(r) .. "\n") - luci.http.write("sysinfo.hostname=" .. sanitize(luci.sys.hostname()) .. "\n") - luci.http.write("sysinfo.load1=" .. tostring(l1) .. "\n") - luci.http.write("sysinfo.load5=" .. tostring(l5) .. "\n") - luci.http.write("sysinfo.load15=" .. tostring(l15) .. "\n") - luci.http.write("sysinfo.defaultgw=" .. dr or "" .. "\n") - - - -- Freifunk - local ff = uci.get_all("freifunk") or {} - for k, v in pairs(ff) do - for i, j in pairs(v) do - if i:sub(1, 1) ~= "." then - luci.http.write("freifunk." .. k .. "." .. i .. "=" .. j .. "\n") - end - end - end -end - -function sanitize(val) - return val:gsub("\n", "\t") -end
\ No newline at end of file diff --git a/modules/freifunk/luasrc/view/freifunk/contact.htm b/modules/freifunk/luasrc/view/freifunk/contact.htm index 8de7b8d1c..12b072c02 100644 --- a/modules/freifunk/luasrc/view/freifunk/contact.htm +++ b/modules/freifunk/luasrc/view/freifunk/contact.htm @@ -13,7 +13,7 @@ $Id$ -%> <%+header%> -<% local contact = luci.model.uci.get_all("freifunk", "contact") %> +<% local contact = luci.model.uci.cursor():get_all("freifunk", "contact") %> <h1><%:contact%></h1> <table cellspacing="0" cellpadding="6"> <tr><th><%:nickname%>:</th><td><%=contact.nickname%></td></tr> diff --git a/modules/freifunk/luasrc/view/freifunk/index.htm b/modules/freifunk/luasrc/view/freifunk/index.htm index 2d9b5a63e..d9cc6a30d 100644 --- a/modules/freifunk/luasrc/view/freifunk/index.htm +++ b/modules/freifunk/luasrc/view/freifunk/index.htm @@ -13,7 +13,7 @@ $Id$ -%> <%+header%> -<% local ff = luci.model.uci.get_all("freifunk") %> +<% local ff = luci.model.uci.cursor():get_all("freifunk") %> <h1><%:hellonet%> <%=ff.community.name%>!</h1> <p><%:public1%><br /> <%:public2%><%=luci.sys.hostname()%>. <%:public3%> diff --git a/modules/rpc/luasrc/controller/rpc/uci.lua b/modules/rpc/luasrc/controller/rpc/uci.lua index 2dab4e01a..de7da2de7 100644 --- a/modules/rpc/luasrc/controller/rpc/uci.lua +++ b/modules/rpc/luasrc/controller/rpc/uci.lua @@ -13,7 +13,8 @@ http://www.apache.org/licenses/LICENSE-2.0 $Id$ ]]-- -local uci = require "luci.model.uci" +local uci = require "luci.model.uci".cursor() +local ucis = require "luci.model.uci".cursor_state() local table = require "table" @@ -21,73 +22,73 @@ module "luci.controller.rpc.uci" _M, _PACKAGE, _NAME = nil, nil, nil function add(config, ...) - uci.load_config(config) - local stat = uci.add(config, ...) - return uci.save_config(config) and stat + uci:load(config) + local stat = uci:add(config, ...) + return uci:save(config) and stat end function apply(config) - return uci.apply(config) + return uci:apply(config) end function changes(...) - return uci.changes(...) + return uci:changes(...) end function commit(config) - return uci.load(config) and uci.commit(config) + return uci:load(config) and uci:commit(config) end function delete(config, ...) - uci.load(config) - return uci.delete(config, ...) and uci.save(config) + uci:load(config) + return uci:delete(config, ...) and uci:save(config) end function delete_all(config, ...) - uci.load(config) - return uci.delete_all(config, ...) and uci.save(config) + uci:load(config) + return uci:delete_all(config, ...) and uci:save(config) end function foreach(config, stype) - uci.load_config(config) + uci:load(config) local sections = {} - return uci.foreach(config, stype, function(section) + return uci:foreach(config, stype, function(section) table.insert(sections, section) end) and sections end function get(config, ...) - uci.load_config(config) - return uci.get(config, ...) + uci:load(config) + return uci:get(config, ...) end function get_all(config, ...) - uci.load_config(config) - return uci.get_all(config, ...) + uci:load(config) + return uci:get_all(config, ...) end function get_state(config, ...) - uci.load_state(config) - return uci.get(config, ...) + ucis:load(config) + return ucis:get(config, ...) end function revert(config) - return uci.load(config) and uci.revert(config) + return uci:load(config) and uci:revert(config) end function section(config, ...) - uci.load_config(config) - return uci.section(config, ...) and uci.save_config(config) + uci:load(config) + return uci:section(config, ...) and uci:save(config) end function set(config, ...) - uci.load_config(config) - return uci.set(config, ...) and uci.save_config(config) + uci:load(config) + return uci:set(config, ...) and uci:save(config) end function tset(config, ...) - uci.load_config(config) - return uci.tset(config, ...) and uci.save_config(config) + uci:load(config) + return uci:tset(config, ...) and uci:save(config) end |