diff options
-rw-r--r-- | lualib/rspamadm/configwizard.lua | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/lualib/rspamadm/configwizard.lua b/lualib/rspamadm/configwizard.lua index 65e289d47..7299cb275 100644 --- a/lualib/rspamadm/configwizard.lua +++ b/lualib/rspamadm/configwizard.lua @@ -371,10 +371,21 @@ end return ver ]] + conn:add_cmd('EVAL', {lua_script, '1', symbol_ham}) + local _,ver_ham = conn:exec() + conn:add_cmd('EVAL', {lua_script, '1', symbol_spam}) - local _,ver = conn:exec() + local _,ver_spam = conn:exec() - return tonumber(ver) + -- If one of the classes is missing we still can convert the other one + if ver_ham == 0 and ver_spam == 0 and ver_ham ~= ver_spam then + printf("Current statistics versions do not match: %s -> %s, %s -> %s", + symbol_ham, ver_ham, symbol_spam, ver_spam) + printf("Cannot convert statistics") + return false + end + + return true,tonumber(ver_ham) end local function check_expire(conn) @@ -404,8 +415,8 @@ return ttl end if not cls.new_schema then - local ver = get_version(conn) - + local r,ver = get_version(conn) + if not r then return false end if ver ~= 2 then printf("You are using an old schema for %s/%s", symbol_ham, symbol_spam) try_convert(true) @@ -425,7 +436,8 @@ return ttl end end else - local ver = get_version(conn) + local r,ver = get_version(conn) + if not r then return false end if ver ~= 2 then printf("You have configured new schema for %s/%s but your DB has old data", symbol_spam, symbol_ham) |