mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-28 16:34:13 +01:00
Added MySQL support for delete_old_messages (offline) command.
This commit is contained in:
parent
4d2924a3ef
commit
6b67a66a1b
@ -79,6 +79,7 @@ CREATE TABLE spool (
|
|||||||
) ENGINE=InnoDB CHARACTER SET utf8;
|
) ENGINE=InnoDB CHARACTER SET utf8;
|
||||||
|
|
||||||
CREATE INDEX i_despool USING BTREE ON spool(username);
|
CREATE INDEX i_despool USING BTREE ON spool(username);
|
||||||
|
CREATE INDEX i_spool_created_at USING BTREE ON spool(created_at);
|
||||||
|
|
||||||
CREATE TABLE vcard (
|
CREATE TABLE vcard (
|
||||||
username varchar(250) PRIMARY KEY,
|
username varchar(250) PRIMARY KEY,
|
||||||
|
@ -561,7 +561,19 @@ remove_old_messages(Days, _LServer, mnesia) ->
|
|||||||
ok, offline_msg)
|
ok, offline_msg)
|
||||||
end,
|
end,
|
||||||
mnesia:transaction(F);
|
mnesia:transaction(F);
|
||||||
remove_old_messages(_Days, _LServer, odbc) ->
|
|
||||||
|
remove_old_messages(Days, LServer, odbc) ->
|
||||||
|
case catch ejabberd_odbc:sql_query(
|
||||||
|
LServer,
|
||||||
|
[<<"DELETE FROM spool"
|
||||||
|
" WHERE created_at < "
|
||||||
|
"DATE_SUB(CURDATE(), INTERVAL ">>,
|
||||||
|
integer_to_list(Days), <<" DAY);">>]) of
|
||||||
|
{updated, N} ->
|
||||||
|
?INFO_MSG("~p message(s) deleted from offline spool", [N]);
|
||||||
|
_Error ->
|
||||||
|
?ERROR_MSG("Cannot delete message in offline spool: ~p", [_Error])
|
||||||
|
end,
|
||||||
{atomic, ok};
|
{atomic, ok};
|
||||||
remove_old_messages(_Days, _LServer, riak) ->
|
remove_old_messages(_Days, _LServer, riak) ->
|
||||||
{atomic, ok}.
|
{atomic, ok}.
|
||||||
|
Loading…
Reference in New Issue
Block a user