# HG changeset patch # User Kim Alvefur # Date 1441205014 -7200 # Node ID 1b08597b5e6f677f21e9a30864e1a71fc7989f9a # Parent 8b7bca07f5c03a83095d9fdc54cd94305313dfc2 mod_storage_xmlarchive: Add support for purging (used when deleting users) diff -r 8b7bca07f5c0 -r 1b08597b5e6f mod_storage_xmlarchive/mod_storage_xmlarchive.lua --- a/mod_storage_xmlarchive/mod_storage_xmlarchive.lua Tue Sep 01 17:55:02 2015 +0200 +++ b/mod_storage_xmlarchive/mod_storage_xmlarchive.lua Wed Sep 02 16:43:34 2015 +0200 @@ -224,4 +224,15 @@ return setmetatable({ store = store }, archive_mt); end +function provider:purge(username) + for store in dm.stores(username, module.host) do + local dates = dm.list_load(username, module.host, store) or empty; + if dates[1] and type(dates[1]) == "string" and dates[1]:match("^%d%d%d%d%-%d%d-%d%d$") then + module:log("info", "Store %s looks like an archive store, emptying it...", store); + provider:open(store, "archive"):delete(username); + end + end + return true; +end + module:provides("storage", provider);