Browse Source

[Minor] Add convenience method to set plugin state

tags/1.7.0
Vsevolod Stakhov 6 years ago
parent
commit
12d38f08dd
1 changed files with 19 additions and 0 deletions
  1. 19
    0
      lualib/lua_util.lua

+ 19
- 0
lualib/lua_util.lua View File

@@ -199,4 +199,23 @@ end

exports.spairs = spairs

local function disable_module(modname, how)
for i,mn in ipairs(rspamd_plugins_state.enabled) do
if modname == mn then
table.remove(rspamd_plugins_state.enabled, i)
break
end
end

if how == 'redis' then
table.insert(rspamd_plugins_state.disabled_redis, modname)
elseif how == 'config' then
table.insert(rspamd_plugins_state.disabled_unconfigured, modname)
else
table.insert(rspamd_plugins_state.disabled_failed, modname)
end
end

exports.disable_module = disable_module

return exports

Loading…
Cancel
Save