mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +01:00
Make some standard admin command to get Mnesia info
This commit is contained in:
parent
6b0f7f2a24
commit
7a8de9cfcf
@ -50,6 +50,7 @@
|
|||||||
set_master/1,
|
set_master/1,
|
||||||
backup_mnesia/1, restore_mnesia/1,
|
backup_mnesia/1, restore_mnesia/1,
|
||||||
dump_mnesia/1, dump_table/2, load_mnesia/1,
|
dump_mnesia/1, dump_table/2, load_mnesia/1,
|
||||||
|
mnesia_info/0, mnesia_table_info/1,
|
||||||
install_fallback_mnesia/1,
|
install_fallback_mnesia/1,
|
||||||
dump_to_textfile/1, dump_to_textfile/2,
|
dump_to_textfile/1, dump_to_textfile/2,
|
||||||
mnesia_change_nodename/4,
|
mnesia_change_nodename/4,
|
||||||
@ -357,6 +358,16 @@ get_commands_spec() ->
|
|||||||
args_desc = ["Full path to the text file"],
|
args_desc = ["Full path to the text file"],
|
||||||
args_example = ["/var/lib/ejabberd/database.txt"],
|
args_example = ["/var/lib/ejabberd/database.txt"],
|
||||||
args = [{file, string}], result = {res, restuple}},
|
args = [{file, string}], result = {res, restuple}},
|
||||||
|
#ejabberd_commands{name = mnesia_info, tags = [mnesia],
|
||||||
|
desc = "Dump info on global Mnesia state",
|
||||||
|
module = ?MODULE, function = mnesia_info,
|
||||||
|
args = [], result = {res, string}},
|
||||||
|
#ejabberd_commands{name = mnesia_table_info, tags = [mnesia],
|
||||||
|
desc = "Dump info on Mnesia table state",
|
||||||
|
module = ?MODULE, function = mnesia_table_info,
|
||||||
|
args_desc = ["Mnesia table name"],
|
||||||
|
args_example = ["roster"],
|
||||||
|
args = [{table, string}], result = {res, string}},
|
||||||
#ejabberd_commands{name = install_fallback, tags = [mnesia],
|
#ejabberd_commands{name = install_fallback, tags = [mnesia],
|
||||||
desc = "Install the database from a fallback file",
|
desc = "Install the database from a fallback file",
|
||||||
module = ?MODULE, function = install_fallback_mnesia,
|
module = ?MODULE, function = install_fallback_mnesia,
|
||||||
@ -716,6 +727,13 @@ load_mnesia(Path) ->
|
|||||||
{cannot_load, String}
|
{cannot_load, String}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
mnesia_info() ->
|
||||||
|
lists:flatten(io_lib:format("~p", [mnesia:system_info(all)])).
|
||||||
|
|
||||||
|
mnesia_table_info(Table) ->
|
||||||
|
ATable = list_to_atom(Table),
|
||||||
|
lists:flatten(io_lib:format("~p", [mnesia:table_info(ATable, all)])).
|
||||||
|
|
||||||
install_fallback_mnesia(Path) ->
|
install_fallback_mnesia(Path) ->
|
||||||
case mnesia:install_fallback(Path) of
|
case mnesia:install_fallback(Path) of
|
||||||
ok ->
|
ok ->
|
||||||
|
@ -190,6 +190,9 @@ process(["restart"], _Version) ->
|
|||||||
init:restart(),
|
init:restart(),
|
||||||
?STATUS_SUCCESS;
|
?STATUS_SUCCESS;
|
||||||
|
|
||||||
|
%% TODO: Mnesia operations should not be hardcoded in ejabberd_ctl module.
|
||||||
|
%% For now, I leave them there to avoid breaking those commands for people that
|
||||||
|
%% may be using it (as format of response is going to change).
|
||||||
process(["mnesia"], _Version) ->
|
process(["mnesia"], _Version) ->
|
||||||
print("~p~n", [mnesia:system_info(all)]),
|
print("~p~n", [mnesia:system_info(all)]),
|
||||||
?STATUS_SUCCESS;
|
?STATUS_SUCCESS;
|
||||||
|
Loading…
Reference in New Issue
Block a user