aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBadlop <badlop@process-one.net>2008-08-25 12:08:22 +0000
committerBadlop <badlop@process-one.net>2008-08-25 12:08:22 +0000
commit2d226b39bff778b234e077cab713435f6d4a0083 (patch)
tree4da46a36ccc9622b12ac2394ba05cb73e6b86f83 /src
parentEJAB-624: fixes mod_muc_room:is_visitor/2 to use get_role not get_affiliation (diff)
* src/ejabberd_check.erl: Detect correctly MSSQL and ODBC
configuration (EJAB-710) SVN Revision: 1536
Diffstat (limited to 'src')
-rw-r--r--src/ejabberd_check.erl22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/ejabberd_check.erl b/src/ejabberd_check.erl
index 4436490e7..260c54175 100644
--- a/src/ejabberd_check.erl
+++ b/src/ejabberd_check.erl
@@ -39,19 +39,21 @@
libs() ->
ok.
-%% Consistency check on ejabberd configuration
+%% @doc Consistency check on ejabberd configuration
config() ->
check_database_modules().
check_database_modules() ->
[check_database_module(M)||M<-get_db_used()].
+check_database_module(odbc) ->
+ check_modules(odbc, [odbc, odbc_app, odbc_sup, ejabberd_odbc, ejabberd_odbc_sup, odbc_queries]);
check_database_module(mysql) ->
check_modules(mysql, [mysql, mysql_auth, mysql_conn, mysql_recv]);
check_database_module(pgsql) ->
check_modules(pgsql, [pgsql, pgsql_proto, pgsql_tcp, pgsql_util]).
-%% Issue a critical error and throw an exit if needing module is
+%% @doc Issue a critical error and throw an exit if needing module is
%% missing.
check_modules(DB, Modules) ->
case get_missing_modules(Modules) of
@@ -63,7 +65,7 @@ check_modules(DB, Modules) ->
end.
-%% Return the list of undefined modules
+%% @doc Return the list of undefined modules
get_missing_modules(Modules) ->
lists:filter(fun(Module) ->
case catch Module:module_info() of
@@ -73,7 +75,7 @@ get_missing_modules(Modules) ->
end
end, Modules).
-%% Return the list of databases used
+%% @doc Return the list of databases used
get_db_used() ->
%% Retrieve domains with a database configured:
Domains =
@@ -86,14 +88,22 @@ get_db_used() ->
case check_odbc_option(
ejabberd_config:get_local_option(
{auth_method, Domain})) of
- true -> [element(1, DB)|Acc];
+ true -> [get_db_type(DB)|Acc];
_ -> Acc
end
end,
[], Domains),
lists:usort(DBs).
-%% Return true if odbc option is used
+%% @doc Depending in the DB definition, return which type of DB this is.
+%% Note that MSSQL is detected as ODBC.
+%% @spec (DB) -> mysql | pgsql | odbc
+get_db_type(DB) when is_tuple(DB) ->
+ element(1, DB);
+get_db_type(DB) when is_list(DB) ->
+ odbc.
+
+%% @doc Return true if odbc option is used
check_odbc_option(odbc) ->
true;
check_odbc_option(AuthMethods) when is_list(AuthMethods) ->