comparison plugins/mod_storage_sql.lua @ 11969:395dce95508d

mod_storage_sql: Fix traceback on multi-user deletion jid.join(true, ...) fails. Since we don't know which users this affects, best to clear the whole cache.
author Kim Alvefur <zash@zash.se>
date Tue, 30 Nov 2021 15:24:17 +0100
parents 0f2b5182e80b
children f0e78fa8f24c
comparison
equal deleted inserted replaced
11968:6e1af07921d1 11969:395dce95508d
622 sql_query = string.format(sql_query, t_concat(where, " AND "), 622 sql_query = string.format(sql_query, t_concat(where, " AND "),
623 query.reverse and "ASC" or "DESC", unlimited); 623 query.reverse and "ASC" or "DESC", unlimited);
624 end 624 end
625 return engine:delete(sql_query, unpack(args)); 625 return engine:delete(sql_query, unpack(args));
626 end); 626 end);
627 local cache_key = jid_join(username, host, self.store); 627 if username == true then
628 archive_item_count_cache:set(cache_key, nil); 628 archive_item_count_cache:clear();
629 else
630 local cache_key = jid_join(username, host, self.store);
631 archive_item_count_cache:set(cache_key, nil);
632 end
629 return ok and stmt:affected(), stmt; 633 return ok and stmt:affected(), stmt;
630 end 634 end
631 635
632 function archive_store:users() 636 function archive_store:users()
633 local ok, result = engine:transaction(function() 637 local ok, result = engine:transaction(function()