Changeset

6013:918ab89cb68d

mod_storage_sql2: archive:delete() with username = true deletes for all users
author Kim Alvefur <zash@zash.se>
date Sun, 09 Feb 2014 15:12:13 +0100
parents 6012:7e8a624272bf
children 6014:d61026bee038
files plugins/mod_storage_sql2.lua
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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 "));