1
0
Fork 0
mirror of https://github.com/processone/ejabberd synced 2025-10-05 19:42:11 +02:00

Fix commands export2odbc, connected_users_vhost and push_alltoall (#586)

This commit is contained in:
Badlop 2015-06-02 12:52:15 +02:00
parent 0de7864880
commit 4ed6a3d78f
3 changed files with 5 additions and 47 deletions

View file

@ -31,7 +31,7 @@
-include("logger.hrl").
-export([start/2, stop/1, compile/1, get_cookie/0,
remove_node/1, export2odbc/2, set_password/3,
remove_node/1, set_password/3,
check_password_hash/4, delete_old_users/1,
delete_old_users_vhost/2, ban_account/3,
num_active_users/2, num_resources/2, resource_num/3,
@ -112,11 +112,6 @@ commands() ->
module = ?MODULE, function = remove_node,
args = [{node, string}],
result = {res, rescode}},
#ejabberd_commands{name = export2odbc, tags = [mnesia], %% Copied to ejabberd 2.1.x after 11
desc = "Export Mnesia tables to files in directory",
module = ?MODULE, function = export2odbc,
args = [{host, string}, {path, string}],
result = {res, rescode}},
#ejabberd_commands{name = num_active_users, tags = [accounts, stats],
desc = "Get number of users active in the last days",
@ -233,7 +228,7 @@ commands() ->
tags = [session],
desc = "Get the list of established sessions in a vhost",
module = ?MODULE, function = connected_users_vhost,
args = [{host, string}],
args = [{host, binary}],
result = {connected_users_vhost, {list, {sessions, string}}}},
#ejabberd_commands{name = user_sessions_info,
tags = [session],
@ -388,7 +383,7 @@ commands() ->
#ejabberd_commands{name = push_alltoall, tags = [roster],
desc = "Add all the users to all the users of Host in Group",
module = ?MODULE, function = push_alltoall,
args = [{host, string}, {group, string}],
args = [{host, binary}, {group, binary}],
result = {res, rescode}},
#ejabberd_commands{name = get_last, tags = [last],
@ -505,25 +500,6 @@ remove_node(Node) ->
mnesia:del_table_copy(schema, list_to_atom(Node)),
ok.
export2odbc(Host, Directory) ->
Tables = [
{export_last, last},
{export_offline, offline},
{export_passwd, passwd},
{export_private_storage, private_storage},
{export_roster, roster},
{export_vcard, vcard},
{export_vcard_search, vcard_search}],
Export = fun({TableFun, Table}) ->
Filename = filename:join([Directory, atom_to_list(Table)++".txt"]),
io:format("Trying to export Mnesia table '~p' on Host '~s' to file '~s'~n", [Table, Host, Filename]),
Res = (catch ejd2odbc:TableFun(Host, Filename)),
io:format(" Result: ~p~n", [Res])
end,
lists:foreach(Export, Tables),
ok.
%%%
%%% Accounts
%%%