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

Fix detection of mod_last at server start (EJAB-641)

This commit is contained in:
Badlop 2010-12-03 17:23:24 +01:00
parent 4e2bd18c7f
commit a8bf889e79

View File

@ -70,7 +70,7 @@ check_cache_last_options(Server) ->
case get_cache_option(Server) of case get_cache_option(Server) of
false -> no_cache; false -> no_cache;
{true, _CacheTime} -> {true, _CacheTime} ->
case get_mod_last_enabled(Server) of case get_mod_last_configured(Server) of
no_mod_last -> no_mod_last ->
?ERROR_MSG("In host ~p extauth is used, extauth_cache is enabled but " ?ERROR_MSG("In host ~p extauth is used, extauth_cache is enabled but "
"mod_last is not enabled.", [Server]), "mod_last is not enabled.", [Server]),
@ -355,7 +355,19 @@ get_mod_last_enabled(ServerB) when is_binary(ServerB)->
Server = binary_to_list(ServerB), Server = binary_to_list(ServerB),
get_mod_last_enabled(Server); get_mod_last_enabled(Server);
get_mod_last_enabled(Server) -> get_mod_last_enabled(Server) ->
case lists:member(mod_last, gen_mod:loaded_modules(Server)) of case gen_mod:is_loaded(Server, mod_last) of
true -> mod_last; true -> mod_last;
false -> no_mod_last false -> no_mod_last
end. end.
get_mod_last_configured(Server) ->
ML = is_configured(Server, mod_last),
MLO = is_configured(Server, mod_last_odbc),
case {ML, MLO} of
{true, _} -> mod_last;
{false, true} -> mod_last_odbc;
{false, false} -> no_mod_last
end.
is_configured(Host, Module) ->
lists:keymember(Module, 1, ejabberd_config:get_local_option({modules, Host})).