From 46ca7a84233f88918faf06d8fe5ef3b5d18ba2d3 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Fri, 23 Feb 2018 14:33:48 +0000 Subject: [PATCH] [Minor] Fix setting of the keys during statconvert --- lualib/lua_stat.lua | 8 +++----- lualib/rspamadm/configwizard.lua | 6 +++--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/lualib/lua_stat.lua b/lualib/lua_stat.lua index d3a435554..5c7ca7f31 100644 --- a/lualib/lua_stat.lua +++ b/lualib/lua_stat.lua @@ -304,11 +304,9 @@ end logger.errx('Cannot update learns for user: ' .. user) return false end - if user ~= '' then - if not conn:add_cmd('SADD', {symbol .. '_keys', 'RS' .. user}) then - logger.errx('Cannot update learns for user: ' .. user) - return false - end + if not conn:add_cmd('SADD', {symbol .. '_keys', 'RS' .. user}) then + logger.errx('Cannot update learns for user: ' .. user) + return false end end -- Set version diff --git a/lualib/rspamadm/configwizard.lua b/lualib/rspamadm/configwizard.lua index 8607cdc1e..3aabea41f 100644 --- a/lualib/rspamadm/configwizard.lua +++ b/lualib/rspamadm/configwizard.lua @@ -367,9 +367,9 @@ end return ver ]] - local ver = conn:add_cmd('EVAL', {lua_script, '1', symbol_spam}) - - if ver ~= 2 then + conn:add_cmd('EVAL', {lua_script, '1', symbol_spam}) + local _,ver = conn:exec() + if tonumber(ver) ~= 2 then printf("You have configured new schema for %s/%s but your DB has old data", symbol_spam, symbol_ham) try_convert() -- 2.39.5