diff mod_storage_xmlarchive/mod_storage_xmlarchive.lua @ 5740:100110d539d3

mod_storage_xmlarchive: Migrate all users/rooms if no JID argument given
author Kim Alvefur <zash@zash.se>
date Tue, 28 Nov 2023 19:48:34 +0100
parents 79ba1a1a75cc
children 5232d12eb74d
line wrap: on
line diff
--- a/mod_storage_xmlarchive/mod_storage_xmlarchive.lua	Mon Nov 27 17:16:15 2023 +0100
+++ b/mod_storage_xmlarchive/mod_storage_xmlarchive.lua	Tue Nov 28 19:48:34 2023 +0100
@@ -445,7 +445,7 @@
 end
 
 function archive:users()
-	return it.filter(skip_at_date, dm.users(module.host, self.store, "list"));
+	return it.filter(skip_at_date, dm.users(self.host, self.store, "list"));
 end
 
 local provider = {};
@@ -548,13 +548,19 @@
 
 		local store = arg[4];
 		if arg[3] == "internal" then
-			for i = 5, #arg do
-				local user, host = jid.prepped_split(arg[i]);
-				if not user then
-					print(string.format("Argument #%d (%q) is an invalid JID, aborting", i, arg[i]));
-					os.exit(1);
+			if arg[5] then
+				for i = 5, #arg do
+					local user, host = jid.prepped_split(arg[i]);
+					if not user then
+						print(string.format("Argument #%d (%q) is an invalid JID, aborting", i, arg[i]));
+						os.exit(1);
+					end
+					convert(user, host, store);
 				end
-				convert(user, host, store);
+			else
+				for user in archive.users({ host = host; store = store }) do
+					convert(user, host, store);
+				end
 			end
 			print("Done");
 			return 0;
@@ -563,6 +569,6 @@
 			print("Check out https://modules.prosody.im/mod_migrate");
 		end
 	end
-	print("prosodyctl mod_storage_xmlarchive convert (from|to) internal (archive|archive2|muc_log) user@host");
+	print("prosodyctl mod_storage_xmlarchive convert (from|to) internal (archive|archive2|muc_log) [user@host]");
 end