summaryrefslogtreecommitdiffhomepage
path: root/modules/admin-full/luasrc/controller/admin
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-08-26 23:00:44 +0000
committerSteven Barth <steven@midlink.org>2008-08-26 23:00:44 +0000
commit91ba7c42f5b45614c9f4c803d09399f08a8e27b1 (patch)
tree21d1e1d67b3bee82eb123c0c5dbb274f2fcb6b59 /modules/admin-full/luasrc/controller/admin
parent43b3217e5595acc91ff6d7614a5c21c88696fbcc (diff)
UCI API changes
Diffstat (limited to 'modules/admin-full/luasrc/controller/admin')
-rw-r--r--modules/admin-full/luasrc/controller/admin/network.lua6
-rw-r--r--modules/admin-full/luasrc/controller/admin/system.lua2
-rw-r--r--modules/admin-full/luasrc/controller/admin/uci.lua18
3 files changed, 14 insertions, 12 deletions
diff --git a/modules/admin-full/luasrc/controller/admin/network.lua b/modules/admin-full/luasrc/controller/admin/network.lua
index 23a575852b..f95b8324dd 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 fdddf6b8d6..6cf951a154 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 5dd0aaf6e2..f5a45707c5 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