diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-03-03 12:47:33 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-03-03 12:47:33 +0000 |
commit | 63a9a0b5a875a2e33d61906eb62b0afa08e24d52 (patch) | |
tree | 9c7cf86d736dfab03d37c37d4e04e3141b47c57d /lualib | |
parent | faef7725273c49d379f0b1e237da944a93741097 (diff) | |
download | rspamd-63a9a0b5a875a2e33d61906eb62b0afa08e24d52.tar.gz rspamd-63a9a0b5a875a2e33d61906eb62b0afa08e24d52.zip |
[Feature] Add concept of experimental modules
Diffstat (limited to 'lualib')
-rw-r--r-- | lualib/lua_util.lua | 21 | ||||
-rw-r--r-- | lualib/rspamadm/plugins_stats.lua | 10 |
2 files changed, 26 insertions, 5 deletions
diff --git a/lualib/lua_util.lua b/lualib/lua_util.lua index a7509665a..1f58953ce 100644 --- a/lualib/lua_util.lua +++ b/lualib/lua_util.lua @@ -250,7 +250,7 @@ exports.spairs = spairs --[[[ -- @function lua_util.disable_module(modname, how) --- Disables a plugin or disables redis for a plugin. +-- Disables a plugin or disables a plugin. -- @param {string} modname name of plugin to disable -- @param {string} how 'redis' to disable redis, 'config' to disable startup --]] @@ -264,6 +264,8 @@ local function disable_module(modname, how) rspamd_plugins_state.disabled_redis[modname] = {} elseif how == 'config' then rspamd_plugins_state.disabled_unconfigured[modname] = {} + elseif how == 'experimental' then + rspamd_plugins_state.disabled_experimental[modname] = {} else rspamd_plugins_state.disabled_failed[modname] = {} end @@ -271,6 +273,23 @@ end exports.disable_module = disable_module +--[[[ +-- @function lua_util.disable_module(modname) +-- Checks experimental plugins state and disable if needed +-- @param {string} modname name of plugin to check +-- @return {boolean} true if plugin should be enabled, false otherwise +--]] +local function check_experimental(modname) + if rspamd_config:experimental_enabled() then + return true + else + disable_module(modname, 'experimental') + end + + return false +end + +exports.check_experimental = check_experimental --[[[ -- @function lua_util.parse_time_interval(str) diff --git a/lualib/rspamadm/plugins_stats.lua b/lualib/rspamadm/plugins_stats.lua index de4aec2c8..5c9797a9e 100644 --- a/lualib/rspamadm/plugins_stats.lua +++ b/lualib/rspamadm/plugins_stats.lua @@ -36,11 +36,13 @@ end return function(args, _) print_plugins_table(rspamd_plugins_state.enabled, "enabled") print_plugins_table(rspamd_plugins_state.disabled_explicitly, - "disabled (explicitly)") + "disabled (explicitly)") print_plugins_table(rspamd_plugins_state.disabled_unconfigured, - "disabled (unconfigured)") + "disabled (unconfigured)") print_plugins_table(rspamd_plugins_state.disabled_redis, - "disabled (no Redis)") + "disabled (no Redis)") + print_plugins_table(rspamd_plugins_state.disabled_experimental, + "disabled (experimental)") print_plugins_table(rspamd_plugins_state.disabled_failed, - "disabled (failed)") + "disabled (failed)") end
\ No newline at end of file |