diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-03-12 15:48:41 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-03-12 15:48:41 +0000 |
commit | b9a4b9eea95c361e8b7dbb63fdf74e6f21ad98cc (patch) | |
tree | 3fa53370a4d3eff5e0f58eb35c3bbb1ab58a8e78 /lualib/rspamadm | |
parent | 3f86aa3aafbc193460cab91ec1657dba0dee1433 (diff) | |
download | rspamd-b9a4b9eea95c361e8b7dbb63fdf74e6f21ad98cc.tar.gz rspamd-b9a4b9eea95c361e8b7dbb63fdf74e6f21ad98cc.zip |
[Minor] Check sqlite databases before conversation
Diffstat (limited to 'lualib/rspamadm')
-rw-r--r-- | lualib/rspamadm/configwizard.lua | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/lualib/rspamadm/configwizard.lua b/lualib/rspamadm/configwizard.lua index 07923df06..25e665aa0 100644 --- a/lualib/rspamadm/configwizard.lua +++ b/lualib/rspamadm/configwizard.lua @@ -452,17 +452,24 @@ local function setup_statistic(cfg, changes) '100d') expire = lua_util.parse_time_interval(expire) + local reset_previous = ask_yes_no("Reset previuous data?") if ask_yes_no('Do you wish to convert them to Redis?', true) then for _,cls in ipairs(sqlite_configs) do - if not lua_stat_tools.convert_sqlite_to_redis(parsed_redis, cls.db_spam, - cls.db_ham, cls.symbol_spam, cls.symbol_ham, cls.learn_cache, expire, - reset_previous) then - rspamd_logger.errx('conversion failed') + if rspamd_util.file_exists(cls.db_spam) and rspamd_util.file_exists(cls.db_ham) then + if not lua_stat_tools.convert_sqlite_to_redis(parsed_redis, cls.db_spam, + cls.db_ham, cls.symbol_spam, cls.symbol_ham, cls.learn_cache, expire, + reset_previous) then + rspamd_logger.errx('conversion failed') - return false + return false + end + else + rspamd_logger.messagex('cannot find %s and %s, skip conversation', + cls.db_spam, cls.db_ham) end + rspamd_logger.messagex('Converted classifier to the from sqlite to redis') changes.l['classifier-bayes.conf'] = { backend = 'redis', |