UCI API changes
[project/luci.git] / modules / admin-full / luasrc / controller / admin / uci.lua
index 5dd0aaf6e2f07ff173bffe3b46472a7ffdad5def..f5a45707c577e8fa1e7160f452e9df2cb0b9f977 100644 (file)
@@ -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