From: Vsevolod Stakhov Date: Fri, 23 Feb 2018 14:33:48 +0000 (+0000) Subject: [Minor] Fix setting of the keys during statconvert X-Git-Tag: 1.7.0~141 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=46ca7a84233f88918faf06d8fe5ef3b5d18ba2d3;p=thirdparty%2Frspamd.git [Minor] Fix setting of the keys during statconvert --- diff --git a/lualib/lua_stat.lua b/lualib/lua_stat.lua index d3a4355547..5c7ca7f312 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 8607cdc1e1..3aabea41fe 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()