25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-22 16:20:52 +01:00

* src/ejabberd_ctl.erl: Added command for listing all registered

users

* src/ejabberd_ctl.erl: Bugfix, support for text-load and restore
(thanks to Leif Johansson)

SVN Revision: 229
This commit is contained in:
Alexey Shchepin 2004-05-05 20:34:54 +00:00
parent a16524151c
commit f7275fb796
2 changed files with 65 additions and 16 deletions

View File

@ -1,3 +1,11 @@
2004-05-05 Alexey Shchepin <alexey@sevcom.net>
* src/ejabberd_ctl.erl: Added command for listing all registered
users
* src/ejabberd_ctl.erl: Bugfix, support for text-load and restore
(thanks to Leif Johansson)
2004-05-04 Alexey Shchepin <alexey@sevcom.net> 2004-05-04 Alexey Shchepin <alexey@sevcom.net>
* src/web/ejabberd_web_admin.erl: Updated * src/web/ejabberd_web_admin.erl: Updated

View File

@ -72,7 +72,7 @@ process(Node, ["unregister", User]) ->
process(Node, ["backup", Path]) -> process(Node, ["backup", Path]) ->
case rpc:call(Node, mnesia, backup, [Path]) of case rpc:call(Node, mnesia, backup, [Path]) of
{atomic, ok} -> ok ->
ok; ok;
{error, Reason} -> {error, Reason} ->
io:format("Can't store backup in ~p on node ~p: ~p~n", io:format("Can't store backup in ~p on node ~p: ~p~n",
@ -82,6 +82,30 @@ process(Node, ["backup", Path]) ->
[Path, Node, Reason]) [Path, Node, Reason])
end; end;
process(Node, ["dump", Path]) ->
case rpc:call(Node, mnesia, dump_to_textfile, [Path]) of
ok ->
ok;
{error, Reason} ->
io:format("Can't store dump in ~p on node ~p: ~p~n",
[Path, Node, Reason]);
{badrpc, Reason} ->
io:format("Can't store dump in ~p on node ~p: ~p~n",
[Path, Node, Reason])
end;
process(Node, ["load", Path]) ->
case rpc:call(Node, mnesia, load_textfile, [Path]) of
ok ->
ok;
{error, Reason} ->
io:format("Can't load dump in ~p on node ~p: ~p~n",
[Path, Node, Reason]);
{badrpc, Reason} ->
io:format("Can't load dump in ~p on node ~p: ~p~n",
[Path, Node, Reason])
end;
process(Node, ["restore", Path]) -> process(Node, ["restore", Path]) ->
case rpc:call(Node, case rpc:call(Node,
mnesia, restore, [Path, [{default_op, keep_tables}]]) of mnesia, restore, [Path, [{default_op, keep_tables}]]) of
@ -107,13 +131,27 @@ process(Node, ["install-fallback", Path]) ->
[Path, Node, Reason]) [Path, Node, Reason])
end; end;
process(Node, ["registered-users"]) ->
case rpc:call(Node, ejabberd_auth, dirty_get_registered_users, []) of
Users when is_list(Users) ->
NewLine = io_lib:format("~n", []),
SUsers = lists:sort(Users),
FUsers = lists:map(fun(U) -> [U, NewLine] end, SUsers),
io:format("~s", [FUsers]),
ok;
{ErrorTag, Reason} when (ErrorTag == error) or (ErrorTag == badrpc) ->
io:format("Can't get list of registered users on node ~p: ~p~n",
[Node, Reason])
end;
process(_Node, _Args) -> process(_Node, _Args) ->
print_usage(). print_usage().
print_usage() -> print_usage() ->
io:format("Usage: ejabberdctl node command~n" io:format(
"Usage: ejabberdctl node command~n"
"~n" "~n"
"Available commands:~n" "Available commands:~n"
" stop\t\t\t\tstop ejabberd~n" " stop\t\t\t\tstop ejabberd~n"
@ -121,9 +159,12 @@ print_usage() ->
" reopen-log\t\t\treopen log file~n" " reopen-log\t\t\treopen log file~n"
" register user password\tregister a user~n" " register user password\tregister a user~n"
" unregister user\t\tunregister a user~n" " unregister user\t\tunregister a user~n"
" backup file\t\t\tstore a backup in file~n" " backup file\t\t\tstore a database backup in file~n"
" restore file\t\t\trestore a backup from file~n" " restore file\t\t\trestore a database backup from file~n"
" install-fallback file\t\tinstall a fallback from file~n" " install-fallback file\t\tinstall a database fallback from file~n"
" dump file\t\t\tdump a database in a text file~n"
" load file\t\t\trestore a database from a text file~n"
" registered-users\t\tlist all registered users~n"
"~n" "~n"
"Example:~n" "Example:~n"
" ejabberdctl ejabberd@host restart~n" " ejabberdctl ejabberd@host restart~n"