]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Add convenience method to set plugin state
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sun, 3 Dec 2017 13:00:43 +0000 (13:00 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sun, 3 Dec 2017 16:55:30 +0000 (16:55 +0000)
lualib/lua_util.lua

index a160bd85eb31c6c3133bbaab1a183b872e91bcb9..b8011e11f018dda063eebba6a00be7cb58bcd633 100644 (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