From b1bc8f5dedfc64d04f45a81cdd722e2135d3a6ee Mon Sep 17 00:00:00 2001 From: peteruithoven Date: Fri, 29 Nov 2013 12:59:51 +0100 Subject: [PATCH] Reset now clears all sections except system --- src/util/settings.lua | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/util/settings.lua b/src/util/settings.lua index f6292e4..94e8253 100644 --- a/src/util/settings.lua +++ b/src/util/settings.lua @@ -284,11 +284,21 @@ end -- @treturn bool|nil True if everything went well, nil in case of error. function M.resetAll() log:info("settings:resetAll") - for k,_ in pairs(baseconfig) do - if not k:match('^[A-Z_]*$') then --TEMP: skip 'constants', which should be moved anyway - M.reset(k) end + + local allSections = uci:get_all(UCI_CONFIG_NAME) + + for key,value in pairs(allSections) do + if key ~= "system" and not key:match('^[A-Z_]*$') then --TEMP: skip 'constants', which should be moved anyway + log:info(" section: "..utils.dump(key)) + uci:delete(UCI_CONFIG_NAME,key) + end end + uci:commit(UCI_CONFIG_NAME) + + local allSections = uci:get_all(UCI_CONFIG_NAME) + log:info(" >allSections: "..utils.dump(allSections)) + return true end