diff options
author | Badlop <badlop@process-one.net> | 2017-06-09 12:02:49 +0200 |
---|---|---|
committer | Badlop <badlop@process-one.net> | 2017-06-09 12:02:49 +0200 |
commit | b25b5c2f987f365a666165802214f42d1b6e230b (patch) | |
tree | 1fffdba662ff9ee8e0fe5ccefc998ba1454b41f3 /src | |
parent | Update dependencies (diff) |
Improve export2sql explanation; remove obsolete and duplicated command
Diffstat (limited to 'src')
-rw-r--r-- | src/ejabberd_admin.erl | 1 | ||||
-rw-r--r-- | src/mod_admin_extra.erl | 28 |
2 files changed, 2 insertions, 27 deletions
diff --git a/src/ejabberd_admin.erl b/src/ejabberd_admin.erl index d56ca0be7..2b17ebc08 100644 --- a/src/ejabberd_admin.erl +++ b/src/ejabberd_admin.erl @@ -303,6 +303,7 @@ get_commands_spec() -> #ejabberd_commands{name = export2sql, tags = [mnesia], desc = "Export virtual host information from Mnesia tables to SQL file", + longdesc = "Configure the modules to use SQL, then call this command." module = ejd2sql, function = export, args_desc = ["Vhost", "Full path to the destination SQL file"], args_example = ["example.com", "/var/lib/ejabberd/example.com.sql"], diff --git a/src/mod_admin_extra.erl b/src/mod_admin_extra.erl index 455871a78..d8f2167fb 100644 --- a/src/mod_admin_extra.erl +++ b/src/mod_admin_extra.erl @@ -36,7 +36,7 @@ % Commands API -export([ % Adminsys - compile/1, get_cookie/0, export2sql/2, + compile/1, get_cookie/0, restart_module/2, % Sessions @@ -148,15 +148,6 @@ get_commands_spec() -> result = {cookie, string}, result_example = "MWTAVMODFELNLSMYXPPD", result_desc = "Erlang cookie used for authentication by ejabberd"}, - #ejabberd_commands{name = export2sql, tags = [mnesia], - desc = "Export Mnesia tables to files in directory", - module = ?MODULE, function = export2sql, - args = [{host, string}, {path, string}], - args_example = ["myserver.com","/tmp/export/sql"], - args_desc = ["Server name", "File to write sql export"], - result = {res, rescode}, - result_example = ok, - result_desc = "Status code: 0 on success, 1 otherwise"}, #ejabberd_commands{name = restart_module, tags = [erlang], desc = "Stop an ejabberd module, reload code and start", module = ?MODULE, function = restart_module, @@ -701,23 +692,6 @@ restart_module(Host, Module) when is_atom(Module) -> end end. -export2sql(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 ejd2sql:TableFun(Host, Filename)), - io:format(" Result: ~p~n", [Res]) - end, - lists:foreach(Export, Tables), - ok. - %%% %%% Accounts %%% |