X-Git-Url: https://git.enpas.org/?a=blobdiff_plain;f=util%2Fdatamanager.lua;h=383e738fa1d93c1b104e284cf9a044d5ef0f6fcc;hb=8ea668bb9a0b77bff5e11aa4214ba00c906dbda2;hp=08d9d6af2e40541aeab30e97b52f92d4af0872fb;hpb=5b982fb9673d347746533db2d2f0cbbc69547f36;p=prosody.git diff --git a/util/datamanager.lua b/util/datamanager.lua index 08d9d6af..383e738f 100644 --- a/util/datamanager.lua +++ b/util/datamanager.lua @@ -113,12 +113,9 @@ function getpath(username, host, datastore, ext, create) if username then if create then mkdir(mkdir(mkdir(data_path).."/"..host).."/"..datastore); end return format("%s/%s/%s/%s.%s", data_path, host, datastore, username, ext); - elseif host then + else if create then mkdir(mkdir(data_path).."/"..host); end return format("%s/%s/%s.%s", data_path, host, datastore, ext); - else - if create then mkdir(data_path); end - return format("%s/%s.%s", data_path, datastore, ext); end end @@ -284,7 +281,7 @@ local type_map = { function users(host, store, typ) typ = type_map[typ or "keyval"]; - local store_dir = format("%s/%s/%s", data_path, encode(host), encode(store)); + local store_dir = format("%s/%s/%s", data_path, encode(host), store); local mode, err = lfs.attributes(store_dir, "mode"); if not mode then @@ -343,7 +340,6 @@ end function purge(username, host) local host_dir = format("%s/%s/", data_path, encode(host)); - local deleted = 0; local errs = {}; for file in lfs.dir(host_dir) do if lfs.attributes(host_dir..file, "mode") == "directory" then