Skip to content

Commit

Permalink
Updated /apt purge to work with sets
Browse files Browse the repository at this point in the history
  • Loading branch information
d87 committed Sep 9, 2020
1 parent 96bb78c commit a26b874
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions migrations.lua
Original file line number Diff line number Diff line change
Expand Up @@ -343,20 +343,15 @@ end

local cleanOpts = function(opts, status, list)
if not opts.assignto then return end
if type(opts.assignto) == "string" then
local slot = opts.assignto
if not list[slot] then opts.assignto = { } end
else
local i = 1
while (i <= #opts.assignto) do
local slot = opts.assignto[i]
if not list[slot] then
table.remove(opts.assignto, i)
i = i - 1
end
i = i + 1
local toRemove = {}
for slot, enabled in pairs(opts.assignto) do
if not list[slot] then
table.insert(toRemove, slot)
end
end
for _, slot in ipairs(toRemove) do
opts.assignto[slot] = nil
end
end

function Aptechka.PurgeDeadAssignments(searchAllClasses)
Expand Down

0 comments on commit a26b874

Please sign in to comment.