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
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
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 =
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) ->