mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
* src/ejabberd_check.erl: Detect correctly MSSQL and ODBC
configuration (EJAB-710) SVN Revision: 1536
This commit is contained in:
parent
35ed848fe8
commit
2d226b39bf
@ -1,3 +1,8 @@
|
|||||||
|
2008-08-25 Badlop <badlop@process-one.net>
|
||||||
|
|
||||||
|
* src/ejabberd_check.erl: Detect correctly MSSQL and ODBC
|
||||||
|
configuration (EJAB-710)
|
||||||
|
|
||||||
2008-08-24 Geoff Cant <gcant@process-one.net>
|
2008-08-24 Geoff Cant <gcant@process-one.net>
|
||||||
|
|
||||||
* src/mod_mud/mod_muc_room.erl: is_visitor/2 fix - use get_role
|
* src/mod_mud/mod_muc_room.erl: is_visitor/2 fix - use get_role
|
||||||
|
@ -39,19 +39,21 @@
|
|||||||
libs() ->
|
libs() ->
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
%% Consistency check on ejabberd configuration
|
%% @doc Consistency check on ejabberd configuration
|
||||||
config() ->
|
config() ->
|
||||||
check_database_modules().
|
check_database_modules().
|
||||||
|
|
||||||
check_database_modules() ->
|
check_database_modules() ->
|
||||||
[check_database_module(M)||M<-get_db_used()].
|
[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_database_module(mysql) ->
|
||||||
check_modules(mysql, [mysql, mysql_auth, mysql_conn, mysql_recv]);
|
check_modules(mysql, [mysql, mysql_auth, mysql_conn, mysql_recv]);
|
||||||
check_database_module(pgsql) ->
|
check_database_module(pgsql) ->
|
||||||
check_modules(pgsql, [pgsql, pgsql_proto, pgsql_tcp, pgsql_util]).
|
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.
|
%% missing.
|
||||||
check_modules(DB, Modules) ->
|
check_modules(DB, Modules) ->
|
||||||
case get_missing_modules(Modules) of
|
case get_missing_modules(Modules) of
|
||||||
@ -63,7 +65,7 @@ check_modules(DB, Modules) ->
|
|||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
||||||
%% Return the list of undefined modules
|
%% @doc Return the list of undefined modules
|
||||||
get_missing_modules(Modules) ->
|
get_missing_modules(Modules) ->
|
||||||
lists:filter(fun(Module) ->
|
lists:filter(fun(Module) ->
|
||||||
case catch Module:module_info() of
|
case catch Module:module_info() of
|
||||||
@ -73,7 +75,7 @@ get_missing_modules(Modules) ->
|
|||||||
end
|
end
|
||||||
end, Modules).
|
end, Modules).
|
||||||
|
|
||||||
%% Return the list of databases used
|
%% @doc Return the list of databases used
|
||||||
get_db_used() ->
|
get_db_used() ->
|
||||||
%% Retrieve domains with a database configured:
|
%% Retrieve domains with a database configured:
|
||||||
Domains =
|
Domains =
|
||||||
@ -86,14 +88,22 @@ get_db_used() ->
|
|||||||
case check_odbc_option(
|
case check_odbc_option(
|
||||||
ejabberd_config:get_local_option(
|
ejabberd_config:get_local_option(
|
||||||
{auth_method, Domain})) of
|
{auth_method, Domain})) of
|
||||||
true -> [element(1, DB)|Acc];
|
true -> [get_db_type(DB)|Acc];
|
||||||
_ -> Acc
|
_ -> Acc
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
[], Domains),
|
[], Domains),
|
||||||
lists:usort(DBs).
|
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) ->
|
check_odbc_option(odbc) ->
|
||||||
true;
|
true;
|
||||||
check_odbc_option(AuthMethods) when is_list(AuthMethods) ->
|
check_odbc_option(AuthMethods) when is_list(AuthMethods) ->
|
||||||
|
Loading…
Reference in New Issue
Block a user