25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-22 17:28:25 +01:00

Add ext_mod paths before checking config (processone/ejabberd-contrib#263)

This commit is contained in:
Badlop 2019-04-03 12:50:28 +02:00
parent 623a9ec3ba
commit 4e591a73c5
2 changed files with 7 additions and 3 deletions

View File

@ -71,6 +71,7 @@ start() ->
[named_table, public, {read_concurrency, true}]), [named_table, public, {read_concurrency, true}]),
catch ets:new(ejabberd_db_modules, catch ets:new(ejabberd_db_modules,
[named_table, public, {read_concurrency, true}]), [named_table, public, {read_concurrency, true}]),
ext_mod:add_paths(),
case load_file(ConfigFile) of case load_file(ConfigFile) of
{ok, State1} -> {ok, State1} ->
UnixTime = erlang:system_time(second), UnixTime = erlang:system_time(second),

View File

@ -32,7 +32,7 @@
-export([start_link/0, update/0, check/1, -export([start_link/0, update/0, check/1,
available_command/0, available/0, available/1, available_command/0, available/0, available/1,
installed_command/0, installed/0, installed/1, installed_command/0, installed/0, installed/1,
install/1, uninstall/1, upgrade/0, upgrade/1, install/1, uninstall/1, upgrade/0, upgrade/1, add_paths/0,
add_sources/1, add_sources/2, del_sources/1, modules_dir/0, add_sources/1, add_sources/2, del_sources/1, modules_dir/0,
config_dir/0, opt_type/1, get_commands_spec/0]). config_dir/0, opt_type/1, get_commands_spec/0]).
@ -54,13 +54,16 @@ start_link() ->
init([]) -> init([]) ->
process_flag(trap_exit, true), process_flag(trap_exit, true),
[code:add_patha(module_ebin_dir(Module)) add_paths(),
|| {Module, _} <- installed()],
application:start(inets), application:start(inets),
inets:start(httpc, [{profile, ext_mod}]), inets:start(httpc, [{profile, ext_mod}]),
ejabberd_commands:register_commands(get_commands_spec()), ejabberd_commands:register_commands(get_commands_spec()),
{ok, #state{}}. {ok, #state{}}.
add_paths() ->
[code:add_patha(module_ebin_dir(Module))
|| {Module, _} <- installed()].
handle_call(_Request, _From, State) -> handle_call(_Request, _From, State) ->
Reply = ok, Reply = ok,
{reply, Reply, State}. {reply, Reply, State}.