diff options
author | Badlop <badlop@process-one.net> | 2016-03-29 15:25:24 +0200 |
---|---|---|
committer | Badlop <badlop@process-one.net> | 2016-03-29 15:26:34 +0200 |
commit | 78a44d80996ce2dbc8d6a773920f81c8cfc89e89 (patch) | |
tree | 56835b1912ab1287d36fed2c49d5eaa3086fa55a /src/ejabberd_app.erl | |
parent | Fix commands api option (diff) |
Move start and stop_modules/0 from ejabberd_app to gen_mod (#1039)
Diffstat (limited to 'src/ejabberd_app.erl')
-rw-r--r-- | src/ejabberd_app.erl | 42 |
1 files changed, 3 insertions, 39 deletions
diff --git a/src/ejabberd_app.erl b/src/ejabberd_app.erl index e493eac01..b25bf231b 100644 --- a/src/ejabberd_app.erl +++ b/src/ejabberd_app.erl @@ -30,7 +30,7 @@ -behaviour(application). --export([start_modules/0, start/2, prep_stop/1, stop/1, +-export([start/2, prep_stop/1, stop/1, init/0, opt_type/1]). -include("ejabberd.hrl"). @@ -71,7 +71,7 @@ start(normal, _Args) -> maybe_add_nameservers(), ejabberd_auth:start(), ejabberd_oauth:start(), - start_modules(), + gen_mod:start_modules(), ejabberd_listener:start_listeners(), ?INFO_MSG("ejabberd ~s is started in the node ~p", [?VERSION, node()]), Sup; @@ -83,7 +83,7 @@ start(_, _) -> %% before shutting down the processes of the application. prep_stop(State) -> ejabberd_listener:stop_listeners(), - stop_modules(), + gen_mod:stop_modules(), ejabberd_admin:stop(), broadcast_c2s_shutdown(), timer:sleep(5000), @@ -137,42 +137,6 @@ db_init() -> ejabberd:start_app(mnesia, permanent), mnesia:wait_for_tables(mnesia:system_info(local_tables), infinity). -%% Start all the modules in all the hosts -start_modules() -> - lists:foreach( - fun(Host) -> - Modules = ejabberd_config:get_option( - {modules, Host}, - fun(Mods) -> - lists:map( - fun({M, A}) when is_atom(M), is_list(A) -> - {M, A} - end, Mods) - end, []), - lists:foreach( - fun({Module, Args}) -> - gen_mod:start_module(Host, Module, Args) - end, Modules) - end, ?MYHOSTS). - -%% Stop all the modules in all the hosts -stop_modules() -> - lists:foreach( - fun(Host) -> - Modules = ejabberd_config:get_option( - {modules, Host}, - fun(Mods) -> - lists:map( - fun({M, A}) when is_atom(M), is_list(A) -> - {M, A} - end, Mods) - end, []), - lists:foreach( - fun({Module, _Args}) -> - gen_mod:stop_module_keep_config(Host, Module) - end, Modules) - end, ?MYHOSTS). - connect_nodes() -> Nodes = ejabberd_config:get_option( cluster_nodes, |