diff options
author | Matthew Wild <mwild1@gmail.com> | 2013-04-08 12:08:34 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2013-04-08 12:08:34 +0100 |
commit | 0f2516b61786519755e9b63bedf279a4f1a1737c (patch) | |
tree | 4c41585b13e2062d4f79c24949a89faa20926f60 | |
parent | d3aa2851d328cbcd3c9660b945c7acae71657a89 (diff) | |
parent | 5c21c86aab734465ac029051a7f21fc1e3291a72 (diff) | |
download | prosody-0f2516b61786519755e9b63bedf279a4f1a1737c.tar.gz prosody-0f2516b61786519755e9b63bedf279a4f1a1737c.zip |
Merge 0.9->trunk
-rw-r--r-- | net/http/server.lua | 3 | ||||
-rwxr-xr-x | prosodyctl | 1 | ||||
-rw-r--r-- | util/datamanager.lua | 32 |
3 files changed, 25 insertions, 11 deletions
diff --git a/net/http/server.lua b/net/http/server.lua index 20c2da3e..830579c9 100644 --- a/net/http/server.lua +++ b/net/http/server.lua @@ -284,6 +284,9 @@ end function _M.set_default_host(host) default_host = host; end +function _M.fire_event(event, ...) + return events.fire_event(event, ...); +end _M.listener = listener; _M.codes = codes; @@ -51,6 +51,7 @@ local prosody = { lock_globals = function () end; unlock_globals = function () end; installed = CFG_SOURCEDIR ~= nil; + core_post_stanza = function () end; -- TODO: mod_router! }; _G.prosody = prosody; diff --git a/util/datamanager.lua b/util/datamanager.lua index 383e738f..4a4d62b3 100644 --- a/util/datamanager.lua +++ b/util/datamanager.lua @@ -187,17 +187,25 @@ function store(username, host, datastore, data) -- save the datastore local d = "return " .. serialize(data) .. ";\n"; - local ok, msg = atomic_store(getpath(username, host, datastore, nil, true), d); - if not ok then - log("error", "Unable to write to %s storage ('%s') for user: %s@%s", datastore, msg, username or "nil", host or "nil"); - return nil, "Error saving to storage"; - end - if next(data) == nil then -- try to delete empty datastore - log("debug", "Removing empty %s datastore for user %s@%s", datastore, username or "nil", host or "nil"); - os_remove(getpath(username, host, datastore)); - end - -- we write data even when we are deleting because lua doesn't have a - -- platform independent way of checking for non-exisitng files + local mkdir_cache_cleared; + repeat + local ok, msg = atomic_store(getpath(username, host, datastore, nil, true), d); + if not ok then + if not mkdir_cache_cleared then -- We may need to recreate a removed directory + _mkdir = {}; + mkdir_cache_cleared = true; + else + log("error", "Unable to write to %s storage ('%s') for user: %s@%s", datastore, msg, username or "nil", host or "nil"); + return nil, "Error saving to storage"; + end + end + if next(data) == nil then -- try to delete empty datastore + log("debug", "Removing empty %s datastore for user %s@%s", datastore, username or "nil", host or "nil"); + os_remove(getpath(username, host, datastore)); + end + -- we write data even when we are deleting because lua doesn't have a + -- platform independent way of checking for non-exisitng files + until ok; return true; end @@ -354,4 +362,6 @@ function purge(username, host) return #errs == 0, t_concat(errs, ", "); end +_M.path_decode = decode; +_M.path_encode = encode; return _M; |