equal
deleted
inserted
replaced
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 |