diff options
author | Kim Alvefur <zash@zash.se> | 2017-03-23 01:30:58 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2017-03-23 01:30:58 +0100 |
commit | 597d3174276ee35ac59a7eb2109469126d054310 (patch) | |
tree | 8907b93b95ab3e10a7e3fc7aaef48a769cd190b0 /util/datamanager.lua | |
parent | 6e9e2d5167ba8b5261b2038bb9360f06681e9483 (diff) | |
parent | 711e2c8713466ff5fa8d1ed29dcf04d6e2b6e0da (diff) | |
download | prosody-597d3174276ee35ac59a7eb2109469126d054310.tar.gz prosody-597d3174276ee35ac59a7eb2109469126d054310.zip |
Merge 0.10->trunk
Diffstat (limited to 'util/datamanager.lua')
-rw-r--r-- | util/datamanager.lua | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/util/datamanager.lua b/util/datamanager.lua index 2b47c3c4..b825cb33 100644 --- a/util/datamanager.lua +++ b/util/datamanager.lua @@ -24,8 +24,10 @@ local t_insert = table.insert; local t_concat = table.concat; local envloadfile = require"util.envload".envloadfile; local serialize = require "util.serialization".serialize; -local path_separator = assert ( package.config:match ( "^([^\n]+)" ) , "package.config not in standard form" ) -- Extract directory seperator from package.config (an undocumented string that comes with lua) local lfs = require "lfs"; +-- Extract directory seperator from package.config (an undocumented string that comes with lua) +local path_separator = assert ( package.config:match ( "^([^\n]+)" ) , "package.config not in standard form" ) + local prosody = prosody; local raw_mkdir = lfs.mkdir; @@ -130,15 +132,8 @@ local function load(username, host, datastore) -- No such file, ok to ignore return nil; end - local mode = lfs.attributes(getpath(username, host, datastore), "mode"); - if not mode then - log("debug", "Assuming empty %s storage ('%s') for user: %s@%s", datastore, err, username or "nil", host or "nil"); - return nil; - else -- file exists, but can't be read - -- TODO more detailed error checking and logging? - log("error", "Failed to load %s storage ('%s') for user: %s@%s", datastore, err, username or "nil", host or "nil"); - return nil, "Error reading storage"; - end + log("error", "Failed to load %s storage ('%s') for user: %s@%s", datastore, err, username or "nil", host or "nil"); + return nil, "Error reading storage"; end local success, ret = pcall(data); @@ -304,15 +299,8 @@ local function list_load(username, host, datastore) -- No such file, ok to ignore return nil; end - local mode = lfs.attributes(getpath(username, host, datastore, "list"), "mode"); - if not mode then - log("debug", "Assuming empty %s storage ('%s') for user: %s@%s", datastore, err, username or "nil", host or "nil"); - return nil; - else -- file exists, but can't be read - -- TODO more detailed error checking and logging? - log("error", "Failed to load %s storage ('%s') for user: %s@%s", datastore, err, username or "nil", host or "nil"); - return nil, "Error reading storage"; - end + log("error", "Failed to load %s storage ('%s') for user: %s@%s", datastore, err, username or "nil", host or "nil"); + return nil, "Error reading storage"; end local success, ret = pcall(data); |