summaryrefslogtreecommitdiffhomepage
path: root/applications
diff options
context:
space:
mode:
Diffstat (limited to 'applications')
-rw-r--r--applications/luci-fw/luasrc/model/cbi/luci_fw/firewall.lua2
-rw-r--r--applications/luci-fw/luasrc/model/cbi/luci_fw/portfw.lua2
-rw-r--r--applications/luci-fw/luasrc/model/cbi/luci_fw/routing.lua2
-rw-r--r--applications/luci-splash/luasrc/controller/splash/splash.lua2
-rw-r--r--applications/luci-splash/luasrc/model/cbi/splash/splash.lua8
-rw-r--r--applications/luci-splash/luasrc/view/splash/splash.htm2
-rwxr-xr-xapplications/luci-splash/root/usr/bin/luci-splashd5
-rwxr-xr-xapplications/luci-splash/root/usr/sbin/luci-splash29
-rw-r--r--applications/luci-statistics/luasrc/controller/luci_statistics/luci_statistics.lua6
-rw-r--r--applications/luci-statistics/luasrc/statistics/datatree.lua4
-rw-r--r--applications/luci-statistics/luasrc/statistics/rrdtool.lua4
-rwxr-xr-xapplications/luci-statistics/root/usr/bin/stat-genconfig4
12 files changed, 36 insertions, 34 deletions
diff --git a/applications/luci-fw/luasrc/model/cbi/luci_fw/firewall.lua b/applications/luci-fw/luasrc/model/cbi/luci_fw/firewall.lua
index 291989611..51ec4452a 100644
--- a/applications/luci-fw/luasrc/model/cbi/luci_fw/firewall.lua
+++ b/applications/luci-fw/luasrc/model/cbi/luci_fw/firewall.lua
@@ -24,7 +24,7 @@ iface.rmempty = true
oface = s:option(ListValue, "dest")
oface.optional = true
-luci.model.uci.foreach("firewall", "zone",
+luci.model.uci.cursor():foreach("firewall", "zone",
function (section)
iface:value(section.name)
oface:value(section.name)
diff --git a/applications/luci-fw/luasrc/model/cbi/luci_fw/portfw.lua b/applications/luci-fw/luasrc/model/cbi/luci_fw/portfw.lua
index 77e804734..72ff54642 100644
--- a/applications/luci-fw/luasrc/model/cbi/luci_fw/portfw.lua
+++ b/applications/luci-fw/luasrc/model/cbi/luci_fw/portfw.lua
@@ -25,7 +25,7 @@ name.size = 10
iface = s:option(ListValue, "src", translate("fw_zone"))
iface.default = "wan"
-luci.model.uci.foreach("firewall", "zone",
+luci.model.uci.cursor():foreach("firewall", "zone",
function (section)
iface:value(section.name)
end)
diff --git a/applications/luci-fw/luasrc/model/cbi/luci_fw/routing.lua b/applications/luci-fw/luasrc/model/cbi/luci_fw/routing.lua
index d542bcb7f..f8689a05c 100644
--- a/applications/luci-fw/luasrc/model/cbi/luci_fw/routing.lua
+++ b/applications/luci-fw/luasrc/model/cbi/luci_fw/routing.lua
@@ -21,7 +21,7 @@ s.anonymous = true
iface = s:option(ListValue, "src")
oface = s:option(ListValue, "dest")
-luci.model.uci.foreach("firewall", "zone",
+luci.model.uci.cursor():foreach("firewall", "zone",
function (section)
iface:value(section.name)
oface:value(section.name)
diff --git a/applications/luci-splash/luasrc/controller/splash/splash.lua b/applications/luci-splash/luasrc/controller/splash/splash.lua
index dbd266f46..b046ff409 100644
--- a/applications/luci-splash/luasrc/controller/splash/splash.lua
+++ b/applications/luci-splash/luasrc/controller/splash/splash.lua
@@ -22,7 +22,7 @@ function action_activate()
local mac = luci.sys.net.ip4mac(luci.http.getenv("REMOTE_ADDR"))
if mac and luci.http.formvalue("accept") then
os.execute("luci-splash add "..mac.." >/dev/null 2>&1")
- luci.http.redirect(luci.model.uci.get("freifunk", "community", "homepage"))
+ luci.http.redirect(luci.model.uci.cursor():get("freifunk", "community", "homepage"))
else
luci.http.redirect(luci.dispatcher.build_url())
end
diff --git a/applications/luci-splash/luasrc/model/cbi/splash/splash.lua b/applications/luci-splash/luasrc/model/cbi/splash/splash.lua
index 49257f1ba..29bc6d9ab 100644
--- a/applications/luci-splash/luasrc/model/cbi/splash/splash.lua
+++ b/applications/luci-splash/luasrc/model/cbi/splash/splash.lua
@@ -11,21 +11,23 @@ s.template = "cbi/tblsection"
s.addremove = true
s.anonymous = true
+local uci = luci.model.uci.cursor()
+
zone = s:option(ListValue, "zone", "Firewallzone")
-luci.model.uci.foreach("firewall", "zone",
+uci:foreach("firewall", "zone",
function (section)
zone:value(section.name)
end)
iface = s:option(ListValue, "network", "Netzwerk")
-luci.model.uci.foreach("network", "interface",
+uci:foreach("network", "interface",
function (section)
if section[".name"] ~= "loopback" then
iface:value(section[".name"])
end
end)
-luci.model.uci.foreach("network", "alias",
+uci:foreach("network", "alias",
function (section)
iface:value(section[".name"])
end)
diff --git a/applications/luci-splash/luasrc/view/splash/splash.htm b/applications/luci-splash/luasrc/view/splash/splash.htm
index 1988224d7..28a038409 100644
--- a/applications/luci-splash/luasrc/view/splash/splash.htm
+++ b/applications/luci-splash/luasrc/view/splash/splash.htm
@@ -12,7 +12,7 @@ You may obtain a copy of the License at
$Id$
-%>
-<% local c = luci.model.uci.get_all("freifunk", "community") %>
+<% local c = luci.model.uci.cursor():get_all("freifunk", "community") %>
<h1>Willkommen!</h1>
<p>
diff --git a/applications/luci-splash/root/usr/bin/luci-splashd b/applications/luci-splash/root/usr/bin/luci-splashd
index 3e0c938eb..267fbdf0a 100755
--- a/applications/luci-splash/root/usr/bin/luci-splashd
+++ b/applications/luci-splash/root/usr/bin/luci-splashd
@@ -4,7 +4,8 @@ require("socket")
require("luci.ip")
require("luci.model.uci")
-luci.model.uci.load_state("network")
+local uci = luci.model.uci.cursor_state()
+uci:load("network")
local server = socket.bind("0.0.0.0", arg[1] or 8082)
server:settimeout(0, "t")
@@ -16,7 +17,7 @@ while true do
client:settimeout(1)
local srv
local ip = luci.ip.IPv4(client:getpeername())
- luci.model.uci.foreach("network", "interface",
+ uci:foreach("network", "interface",
function (section)
if section.ipaddr then
local net = luci.ip.IPv4(section.ipaddr, section.netmask)
diff --git a/applications/luci-splash/root/usr/sbin/luci-splash b/applications/luci-splash/root/usr/sbin/luci-splash
index 520f87702..82662c871 100755
--- a/applications/luci-splash/root/usr/sbin/luci-splash
+++ b/applications/luci-splash/root/usr/sbin/luci-splash
@@ -5,8 +5,7 @@ require("luci.util")
require("luci.model.uci")
-- Init state session
-luci.model.uci.load_state("luci_splash")
-local uci = luci.model.uci
+local uci = luci.model.uci.cursor_state()
function main(argv)
@@ -60,13 +59,13 @@ end
-- Add a lease to state and invoke add_rule
function add_lease(mac)
- uci.section("luci_splash", "lease", nil, {
+ uci:section("luci_splash", "lease", nil, {
mac = mac,
start = os.time()
})
add_rule(mac)
- uci.save_state("luci_splash")
+ uci:save("luci_splash")
end
@@ -75,7 +74,7 @@ function remove_lease(mac)
mac = mac:lower()
local del = {}
- uci.foreach("luci_splash", "lease",
+ uci:foreach("luci_splash", "lease",
function (section)
if section.mac:lower() == mac then
table.insert(del, section[".name"])
@@ -84,10 +83,10 @@ function remove_lease(mac)
for i,j in ipairs(del) do
remove_rule(j)
- uci.delete("luci_splash", j)
+ uci:delete("luci_splash", j)
end
- uci.save_state("luci_splash")
+ uci:save("luci_splash")
end
@@ -108,7 +107,7 @@ function haslease(mac)
mac = mac:lower()
local stat = false
- uci.foreach("luci_splash", "lease",
+ uci:foreach("luci_splash", "lease",
function (section)
if section.mac:lower() == mac then
stat = true
@@ -124,7 +123,7 @@ end
function iswhitelisted(mac)
mac = mac:lower()
- uci.foreach("luci_splash", "whitelist",
+ uci:foreach("luci_splash", "whitelist",
function (section)
if section.mac:lower() == mac then
stat = true
@@ -150,14 +149,14 @@ function sync()
local time = os.time()
-- Current leases in state files
- local leases = uci.get_all("luci_splash")
+ local leases = uci:get_all("luci_splash")
-- Convert leasetime to seconds
- local leasetime = tonumber(uci.get("luci_splash", "general", "leasetime")) * 3600
+ local leasetime = tonumber(uci:get("luci_splash", "general", "leasetime")) * 3600
-- Clean state file
- uci.load_state("luci_splash")
- uci.revert("luci_splash")
+ uci:load("luci_splash")
+ uci:revert("luci_splash")
-- For all leases
@@ -168,7 +167,7 @@ function sync()
remove_rule(v.mac)
else
-- Rewrite state
- uci.section("luci_splash", "lease", nil, {
+ uci:section("luci_splash", "lease", nil, {
mac = v.mac,
start = v.start
})
@@ -185,7 +184,7 @@ function sync()
end
end
- uci.save_state("luci_splash")
+ uci:save("luci_splash")
end
main(arg) \ No newline at end of file
diff --git a/applications/luci-statistics/luasrc/controller/luci_statistics/luci_statistics.lua b/applications/luci-statistics/luasrc/controller/luci_statistics/luci_statistics.lua
index f16a655dc..5167fe0a9 100644
--- a/applications/luci-statistics/luasrc/controller/luci_statistics/luci_statistics.lua
+++ b/applications/luci-statistics/luasrc/controller/luci_statistics/luci_statistics.lua
@@ -151,9 +151,9 @@ function statistics_render()
local vars = luci.http.formvalue()
local req = luci.dispatcher.context.request
local path = luci.dispatcher.context.dispatched.path
- local uci = luci.model.uci
- local spans = luci.util.split( uci.get( "luci_statistics", "collectd_rrdtool", "RRATimespans" ), "%s+", nil, true )
- local span = vars.timespan or uci.get( "luci_statistics", "rrdtool", "default_timespan" ) or spans[1]
+ local uci = luci.model.uci.cursor()
+ local spans = luci.util.split( uci:get( "luci_statistics", "collectd_rrdtool", "RRATimespans" ), "%s+", nil, true )
+ local span = vars.timespan or uci:get( "luci_statistics", "rrdtool", "default_timespan" ) or spans[1]
local graph = luci.statistics.rrdtool.Graph( luci.util.parse_units( span ) )
local plugin, instances
diff --git a/applications/luci-statistics/luasrc/statistics/datatree.lua b/applications/luci-statistics/luasrc/statistics/datatree.lua
index 5d3d63f99..637fcf466 100644
--- a/applications/luci-statistics/luasrc/statistics/datatree.lua
+++ b/applications/luci-statistics/luasrc/statistics/datatree.lua
@@ -18,8 +18,8 @@ module("luci.statistics.datatree", package.seeall)
local util = require("luci.util")
local sys = require("luci.sys")
local fs = require("luci.fs")
-local uci = require("luci.model.uci")
-local sections = uci.get_all( "luci_statistics" )
+local uci = require("luci.model.uci").cursor()
+local sections = uci:get_all( "luci_statistics" )
Instance = util.class()
diff --git a/applications/luci-statistics/luasrc/statistics/rrdtool.lua b/applications/luci-statistics/luasrc/statistics/rrdtool.lua
index 433524583..23e017036 100644
--- a/applications/luci-statistics/luasrc/statistics/rrdtool.lua
+++ b/applications/luci-statistics/luasrc/statistics/rrdtool.lua
@@ -31,8 +31,8 @@ function Graph.__init__( self, timespan, opts )
opts = opts or { }
- local uci = luci.model.uci
- local sections = uci.get_all( "luci_statistics" )
+ local uci = luci.model.uci.cursor()
+ local sections = uci:get_all( "luci_statistics" )
-- helper classes
self.colors = luci.statistics.rrdtool.colors.Instance()
diff --git a/applications/luci-statistics/root/usr/bin/stat-genconfig b/applications/luci-statistics/root/usr/bin/stat-genconfig
index 3159f6f7f..071cff2ca 100755
--- a/applications/luci-statistics/root/usr/bin/stat-genconfig
+++ b/applications/luci-statistics/root/usr/bin/stat-genconfig
@@ -21,8 +21,8 @@ require("luci.sys.iptparser")
require("luci.util")
local ipt = luci.sys.iptparser.IptParser()
-local uci = luci.model.uci
-local sections = uci.get_all( "luci_statistics" )
+local uci = luci.model.uci.cursor()
+local sections = uci:get_all( "luci_statistics" )
function section( plugin )