Mercurial > prosody-modules
changeset 6513:5fb466693e85
mod_storage_xmlarchive: Ensure list index files are removed
using os.remove() on the list files leaves the new index files behind
since util.datamanager does not know they are removed.
Thanks Link Mauve
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Tue, 07 Apr 2026 21:10:54 +0200 |
| parents | f6c83a8425f2 |
| children | 668b1f0a4dc6 |
| files | mod_storage_xmlarchive/mod_storage_xmlarchive.lua |
| diffstat | 1 files changed, 7 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_storage_xmlarchive/mod_storage_xmlarchive.lua Tue Apr 07 21:09:00 2026 +0200 +++ b/mod_storage_xmlarchive/mod_storage_xmlarchive.lua Tue Apr 07 21:10:54 2026 +0200 @@ -423,7 +423,7 @@ if not ok then return ok, err; end for d = 1, #dates do if dates[d] < before then - os.remove(dm.getpath(username .. "@" .. dates[d], self.host, self.store, "list")); + dm.list_store(username .. "@" .. dates[d], self.host, self.store, empty); os.remove(dm.getpath(username .. "@" .. dates[d], self.host, self.store, "xml")); end end @@ -457,13 +457,13 @@ function provider:purge(username) local encoded_username = dm.path_encode((username or "@") .. "@"); local basepath = prosody.paths.data .. "/" .. dm.path_encode(module.host); - for store in lfs.dir(basepath) do - local store = basepath .. "/" .. dm.path_encode(store); - if lfs.attributes(store, "mode") == "directory" then - for file in lfs.dir(store) do + for rawstore in lfs.dir(basepath) do + local encoded_store = basepath .. "/" .. dm.path_encode(rawstore); + if lfs.attributes(encoded_store, "mode") == "directory" then + for file in lfs.dir(encoded_store) do if file:sub(1, #encoded_username) == encoded_username then - if file:sub(-4) == ".xml" or file:sub(-5) == ".list" then - os.remove(store .. "/" .. file); + if file:sub(-4) == ".xml" or file:sub(-5) == ".list" or file:sub(-5) == ".lidx" then + os.remove(encoded_store .. "/" .. file); end end end
