local tbl = comparator
comparator = function(section)
for k, v in pairs(tbl) do
- if not section[k] == v then
+ if section[k] ~= v then
return false
end
end
local function helper (section)
if not comparator or comparator(section) then
- table.insert(del, section[".name"])
+ del[#del+1] = section[".name"]
end
end
return false
end
-
-Cursor._changes = Cursor.changes
-function Cursor.changes(self, config)
- if config then
- return Cursor._changes(self, config)
- else
- local changes = Cursor._changes(self)
- util.copcall(function()
- for k,v in pairs(require "luci.fs".dir(self:get_savedir())) do
- if v ~= "." and v ~= ".." then
- util.update(changes, Cursor._changes(self, v))
- end
- end
- end)
- return changes
- end
-end
-
-
-- Return a list of initscripts affected by configuration changes.
function Cursor._affected(self, configlist)
configlist = type(configlist) == "table" and configlist or {configlist}
function(section)
if section.affects then
for i, aff in ipairs(section.affects) do
- table.insert(deps, aff)
+ deps[#deps+1] = aff
end
end
end)
for i, dep in ipairs(deps) do
for j, add in ipairs(_resolve_deps(dep)) do
- table.insert(reload, add)
+ reload[#reload+1] = add
end
end
for j, config in ipairs(configlist) do
for i, e in ipairs(_resolve_deps(config)) do
if not util.contains(reloadlist, e) then
- table.insert(reloadlist, e)
+ reloadlist[#reloadlist+1] = e
end
end
end