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

* src/ejabberd_config.erl: Print error when the configuration

requires ODBC, MySQL or PostgreSQL libraries but are not 
installed (EJAB-210).

SVN Revision: 986
This commit is contained in:
Badlop 2007-11-26 19:52:09 +00:00
parent f6848603f9
commit 2078c45656
2 changed files with 36 additions and 0 deletions

View File

@ -1,5 +1,9 @@
2007-11-26 Badlop <badlop@process-one.net>
* src/ejabberd_config.erl: Print error when the configuration
requires ODBC, MySQL or PostgreSQL libraries but are not
installed (EJAB-210).
* src/web/ejabberd_web_admin.erl: Added a favicon (EJAB-379).
* src/msgs/wa.msg: New Walon translation (thanks to

View File

@ -161,6 +161,9 @@ process_host_term(Term, Host, State) ->
State;
{hosts, Hosts} ->
State;
{odbc_server, ODBC_server} ->
odbc_modules_found = check_odbc_modules(ODBC_server),
add_option({odbc_server, Host}, ODBC_server, State);
{Opt, Val} ->
add_option({Opt, Host}, Val, State)
end.
@ -269,3 +272,32 @@ get_local_option(Opt) ->
end.
check_odbc_modules(ODBC_server) ->
case catch check_odbc_modules2(ODBC_server) of
{'EXIT', {undef, [{Module, module_info, []} | _]}} ->
?CRITICAL_MSG("ejabberd is configured to use ODBC, but the Erlang module '~p' is not installed.", [Module]),
odbc_module_not_found;
_ -> odbc_modules_found
end.
check_odbc_modules2(ODBC_server) ->
check_modules_exists([ejabberd_odbc, ejabberd_odbc_sup, odbc_queries]),
case ODBC_server of
{mysql, _Server, _DB, _Username, _Password} ->
check_modules_exists([mysql, mysql_auth, mysql_conn, mysql_recv]);
{mysql, _Server, _Port, _DB, _Username, _Password} ->
check_modules_exists([mysql, mysql_auth, mysql_conn, mysql_recv]);
{pgsql, _Server, _DB, _Username, _Password} ->
check_modules_exists([pgsql, pgsql_proto, pgsql_tcp, pgsql_util]);
{pgsql, _Server, _Port, _DB, _Username, _Password} ->
check_modules_exists([pgsql, pgsql_proto, pgsql_tcp, pgsql_util]);
Server when is_list(Server) ->
ok
end.
check_modules_exists(Modules) ->
[true = is_list(Module:module_info()) || Module <- Modules].