diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-12-03 13:00:43 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-12-03 16:55:30 +0000 |
commit | 12d38f08dd70e39bc0848390d6ec4f1f003ec335 (patch) | |
tree | a9eb35a7d0adf351dce895a9acc4c047e539434f | |
parent | 71e991f97940818ae4ba3b9acf62e7533de49f3a (diff) | |
download | rspamd-12d38f08dd70e39bc0848390d6ec4f1f003ec335.tar.gz rspamd-12d38f08dd70e39bc0848390d6ec4f1f003ec335.zip |
[Minor] Add convenience method to set plugin state
-rw-r--r-- | lualib/lua_util.lua | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lualib/lua_util.lua b/lualib/lua_util.lua index a160bd85e..b8011e11f 100644 --- a/lualib/lua_util.lua +++ b/lualib/lua_util.lua @@ -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 |