changeset 3339:babb584e24a2

mod_http_upload: Run expiry for all users if command run with a hostname
author Kim Alvefur <zash@zash.se>
date Thu, 27 Sep 2018 19:54:26 +0200
parents 7d2400710d65
children 6081cbfd1220
files mod_http_upload/mod_http_upload.lua
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mod_http_upload/mod_http_upload.lua	Thu Sep 27 19:39:55 2018 +0200
+++ b/mod_http_upload/mod_http_upload.lua	Thu Sep 27 19:54:26 2018 +0200
@@ -326,10 +326,18 @@
 module:log("info", "URL: <%s>; Storage path: %s", module:http_url(), storage_path);
 
 function module.command(args)
+	-- luacheck: ignore 421/user
 	if args[1] == "expire" then
 		local split = require "util.jid".prepped_split;
 		for i = 2, #args do
-			assert(expire(split(args[i])));
+			local user, host = split(args[i]);
+			if user then
+				assert(expire(user, host));
+			else
+				for user in datamanager.users(host, module.name, "list") do
+					expire(user, host);
+				end
+			end
 		end
 	end
 end