summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/luasrc
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2018-04-06 09:24:36 +0200
committerJo-Philipp Wich <jo@mein.io>2018-04-06 09:24:36 +0200
commit24ac0d81ee56c5630b38aefbb5526e8bfcf6cd88 (patch)
tree25e08411b55989df540a1c764e14f5c0464ee4a9 /modules/luci-base/luasrc
parent4d6c5d284bfe164c6a4a67423e8ed3c52c4b0b2f (diff)
luci-base: implement luci.model.uci.get_state()
Introduce a get_state() function which can be used to access legacy uci state variables. This is usually not needed anymore but some packages (mainly mwan3) still rely on this. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-base/luasrc')
-rw-r--r--modules/luci-base/luasrc/model/uci.lua12
1 files changed, 10 insertions, 2 deletions
diff --git a/modules/luci-base/luasrc/model/uci.lua b/modules/luci-base/luasrc/model/uci.lua
index bbd9b4cfb..7e1c8f595 100644
--- a/modules/luci-base/luasrc/model/uci.lua
+++ b/modules/luci-base/luasrc/model/uci.lua
@@ -182,11 +182,11 @@ function foreach(self, config, stype, callback)
end
end
-function get(self, config, section, option)
+local function _get(self, operation, config, section, option)
if section == nil then
return nil
elseif type(option) == "string" and option:byte(1) ~= 46 then
- local rv, err = util.ubus("uci", "get", {
+ local rv, err = util.ubus("uci", operation, {
config = config,
section = section,
option = option
@@ -211,6 +211,14 @@ function get(self, config, section, option)
end
end
+function get(self, ...)
+ return _get(self, "get", ...)
+end
+
+function get_state(self, ...)
+ return _get(self, "state", ...)
+end
+
function get_all(self, config, section)
local rv, err = util.ubus("uci", "get", {
config = config,