Software /
code /
prosody
Diff
util/datamanager.lua @ 915:0fe5bf7ab81d
util.datamanager: Don't delete data when first entry in table is 'false'. My favourite bug so far.
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sun, 22 Mar 2009 20:50:37 +0000 |
parent | 896:2c0b9e3c11c3 |
child | 932:1ed3e5fe165a |
line wrap: on
line diff
--- a/util/datamanager.lua Sun Mar 22 17:54:29 2009 +0000 +++ b/util/datamanager.lua Sun Mar 22 20:50:37 2009 +0000 @@ -102,7 +102,8 @@ f:write("return "); append(f, data); f:close(); - if not next(data) then -- try to delete empty datastore + if next(data) == nil then -- try to delete empty datastore + log("debug", "Removing empty %s datastore for user %s@%s", datastore, username, host); os_remove(getpath(username, host, datastore)); end -- we write data even when we are deleting because lua doesn't have a @@ -141,7 +142,8 @@ f:write(");\n"); end f:close(); - if not next(data) then -- try to delete empty datastore + if next(data) == nil then -- try to delete empty datastore + log("debug", "Removing empty %s datastore for user %s@%s", datastore, username, host); os_remove(getpath(username, host, datastore, "list")); end -- we write data even when we are deleting because lua doesn't have a