diff options
author | Badlop <badlop@process-one.net> | 2007-11-26 19:52:09 +0000 |
---|---|---|
committer | Badlop <badlop@process-one.net> | 2007-11-26 19:52:09 +0000 |
commit | 2078c45656792dab1a2bf567d8b14bdf1f2fa1a9 (patch) | |
tree | bab4947010aaefb350dafb7c9fed948d4346407a | |
parent | * src/web/ejabberd_web_admin.erl: Added a favicon (EJAB-379). (diff) |
* src/ejabberd_config.erl: Print error when the configuration
requires ODBC, MySQL or PostgreSQL libraries but are not
installed (EJAB-210).
SVN Revision: 986
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | src/ejabberd_config.erl | 32 |
2 files changed, 36 insertions, 0 deletions
@@ -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 diff --git a/src/ejabberd_config.erl b/src/ejabberd_config.erl index f029dca38..8ee8612cd 100644 --- a/src/ejabberd_config.erl +++ b/src/ejabberd_config.erl @@ -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]. |