mod_storage_sql2: archive:delete() with username = true deletes for all users
authorKim Alvefur <zash@zash.se>
Sun, 09 Feb 2014 15:12:13 +0100
changeset 6013 918ab89cb68d
parent 6012 7e8a624272bf
child 6014 d61026bee038
mod_storage_sql2: archive:delete() with username = true deletes for all users
plugins/mod_storage_sql2.lua
--- a/plugins/mod_storage_sql2.lua	Sun Feb 09 15:09:12 2014 +0100
+++ b/plugins/mod_storage_sql2.lua	Sun Feb 09 15:12:13 2014 +0100
@@ -325,6 +325,10 @@
 		local sql_query = "DELETE FROM `prosodyarchive` WHERE %s;";
 		local args = { host, user or "", store, };
 		local where = { "`host` = ?", "`user` = ?", "`store` = ?", };
+		if user == true then
+			table.remove(args, 2);
+			table.remove(where, 2);
+		end
 		archive_where(query, args, where);
 		archive_where_id_range(query, args, where);
 		sql_query = sql_query:format(t_concat(where, " AND "));