aboutsummaryrefslogtreecommitdiffstats
path: root/lualib/rspamadm
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-03-11 12:46:46 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-03-11 12:46:46 +0000
commitaf1871ee4fc7fdc158195b0d732b18467772c8b4 (patch)
treeee6a11802d7bc6c54b1aa3c50d725e148a7c2865 /lualib/rspamadm
parent014f70501d57e70673bc0c9381ce9880452bf6c8 (diff)
downloadrspamd-af1871ee4fc7fdc158195b0d732b18467772c8b4.tar.gz
rspamd-af1871ee4fc7fdc158195b0d732b18467772c8b4.zip
[Minor] Do not add duplicate changes
Diffstat (limited to 'lualib/rspamadm')
-rw-r--r--lualib/rspamadm/configwizard.lua18
1 files changed, 10 insertions, 8 deletions
diff --git a/lualib/rspamadm/configwizard.lua b/lualib/rspamadm/configwizard.lua
index a5938297d..07923df06 100644
--- a/lualib/rspamadm/configwizard.lua
+++ b/lualib/rspamadm/configwizard.lua
@@ -335,7 +335,7 @@ local function check_redis_classifier(cls, changes)
end
end
- local function try_convert()
+ local function try_convert(update_config)
if ask_yes_no("Do you wish to convert data to the new schema?", true) then
local expire = readline_default("Expire time for new tokens [default: 100d]: ",
'100d')
@@ -346,12 +346,14 @@ local function check_redis_classifier(cls, changes)
printf("Conversion failed")
else
printf("Conversion succeed")
- changes.l['classifier-bayes.conf'] = {
- new_schema = true,
- }
+ if update_config then
+ changes.l['classifier-bayes.conf'] = {
+ new_schema = true,
+ }
- if expire then
- changes.l['classifier-bayes.conf'].expire = expire
+ if expire then
+ changes.l['classifier-bayes.conf'].expire = expire
+ end
end
end
end
@@ -406,7 +408,7 @@ return ttl
if ver ~= 2 then
printf("You are using an old schema for %s/%s", symbol_ham, symbol_spam)
- try_convert()
+ try_convert(true)
else
printf("You have configured an old schema for %s/%s but your data has new layout",
symbol_ham, symbol_spam)
@@ -427,7 +429,7 @@ return ttl
if ver ~= 2 then
printf("You have configured new schema for %s/%s but your DB has old data",
symbol_spam, symbol_ham)
- try_convert()
+ try_convert(false)
end
end
end