Mercurial > prosody-hg
comparison util/datamanager.lua @ 6690:b2e89583d6e6
Merge 0.10->trunk
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Wed, 13 May 2015 22:33:40 +0200 |
| parents | 0217a04722c7 |
| children | 5de6b93d0190 67ac4a0b6e50 |
comparison
equal
deleted
inserted
replaced
| 6679:96e034508978 | 6690:b2e89583d6e6 |
|---|---|
| 346 return true | 346 return true |
| 347 end | 347 end |
| 348 | 348 |
| 349 function purge(username, host) | 349 function purge(username, host) |
| 350 local host_dir = format("%s/%s/", data_path, encode(host)); | 350 local host_dir = format("%s/%s/", data_path, encode(host)); |
| 351 local ok, iter, state, var = pcall(lfs.dir, host_dir); | |
| 352 if not ok then | |
| 353 return ok, iter; | |
| 354 end | |
| 351 local errs = {}; | 355 local errs = {}; |
| 352 for file in lfs.dir(host_dir) do | 356 for file in iter, state, var do |
| 353 if lfs.attributes(host_dir..file, "mode") == "directory" then | 357 if lfs.attributes(host_dir..file, "mode") == "directory" then |
| 354 local store = decode(file); | 358 local store = decode(file); |
| 355 local ok, err = do_remove(getpath(username, host, store)); | 359 local ok, err = do_remove(getpath(username, host, store)); |
| 356 if not ok then errs[#errs+1] = err; end | 360 if not ok then errs[#errs+1] = err; end |
| 357 | 361 |
