util/datamanager.lua
changeset 6684 0217a04722c7
parent 6647 6cb6855f60df
child 6780 5de6b93d0190
child 7203 67ac4a0b6e50
equal deleted inserted replaced
6683:ae34b12c4335 6684:0217a04722c7
   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