| CODENOTIFIER | HelpYou are not signed inSign in |
Project: ejabberd
Revision: 1536
Author: badlop
Date: 25 Aug 2008 08:08:22
Changes: * src/ejabberd_check.erl: Detect correctly MSSQL and ODBC
configuration (EJAB-710)
| ... | ...@@ -39,19 +39,21 @@ | |
| 39 | 39 | libs() -> |
| 40 | 40 | ok. |
| 41 | 41 | |
| 42 | %% Consistency check on ejabberd configuration | |
| 42 | %% @doc Consistency check on ejabberd configuration | |
| 43 | 43 | config() -> |
| 44 | 44 | check_database_modules(). |
| 45 | 45 | |
| 46 | 46 | check_database_modules() -> |
| 47 | 47 | [check_database_module(M)||M<-get_db_used()]. |
| 48 | 48 | |
| 49 | check_database_module(odbc) -> | |
| 50 | check_modules(odbc, [odbc, odbc_app, odbc_sup, ejabberd_odbc, ejabberd_odbc_sup, odbc_queries]); | |
| 49 | 51 | check_database_module(mysql) -> |
| 50 | 52 | check_modules(mysql, [mysql, mysql_auth, mysql_conn, mysql_recv]); |
| 51 | 53 | check_database_module(pgsql) -> |
| 52 | 54 | check_modules(pgsql, [pgsql, pgsql_proto, pgsql_tcp, pgsql_util]). |
| 53 | 55 | |
| 54 | %% Issue a critical error and throw an exit if needing module is | |
| 56 | %% @doc Issue a critical error and throw an exit if needing module is | |
| 55 | 57 | %% missing. |
| 56 | 58 | check_modules(DB, Modules) -> |
| 57 | 59 | case get_missing_modules(Modules) of |
| ... | ...@@ -63,7 +65,7 @@ | |
| 63 | 65 | end. |
| 64 | 66 | |
| 65 | 67 | |
| 66 | %% Return the list of undefined modules | |
| 68 | %% @doc Return the list of undefined modules | |
| 67 | 69 | get_missing_modules(Modules) -> |
| 68 | 70 | lists:filter(fun(Module) -> |
| 69 | 71 | case catch Module:module_info() of |
| ... | ...@@ -73,7 +75,7 @@ | |
| 73 | 75 | end |
| 74 | 76 | end, Modules). |
| 75 | 77 | |
| 76 | %% Return the list of databases used | |
| 78 | %% @doc Return the list of databases used | |
| 77 | 79 | get_db_used() -> |
| 78 | 80 | %% Retrieve domains with a database configured: |
| 79 | 81 | Domains = |
| ... | ...@@ -86,14 +88,22 @@ | |
| 86 | 88 | case check_odbc_option( |
| 87 | 89 | ejabberd_config:get_local_option( |
| 88 | 90 | {auth_method, Domain})) of |
| 89 | true -> [element(1, DB)|Acc]; | |
| 91 | true -> [get_db_type(DB)|Acc]; | |
| 90 | 92 | _ -> Acc |
| 91 | 93 | end |
| 92 | 94 | end, |
| 93 | 95 | [], Domains), |
| 94 | 96 | lists:usort(DBs). |
| 95 | 97 | |
| 96 | %% Return true if odbc option is used | |
| 98 | %% @doc Depending in the DB definition, return which type of DB this is. | |
| 99 | %% Note that MSSQL is detected as ODBC. | |
| 100 | %% @spec (DB) -> mysql | pgsql | odbc | |
| 101 | get_db_type(DB) when is_tuple(DB) -> | |
| 102 | element(1, DB); | |
| 103 | get_db_type(DB) when is_list(DB) -> | |
| 104 | odbc. | |
| 105 | ||
| 106 | %% @doc Return true if odbc option is used | |
| 97 | 107 | check_odbc_option(odbc) -> |
| 98 | 108 | true; |
| 99 | 109 | check_odbc_option(AuthMethods) when is_list(AuthMethods) -> |
| ... | ...@@ -1,3 +1,8 @@ | |
| 1 | 2008-08-25 Badlop <badlop@process-one.net> | |
| 2 | ||
| 3 | * src/ejabberd_check.erl: Detect correctly MSSQL and ODBC | |
| 4 | configuration (EJAB-710) | |
| 5 | ||
| 1 | 6 | 2008-08-24 Geoff Cant <gcant@process-one.net> |
| 2 | 7 | |
| 3 | 8 | * src/mod_mud/mod_muc_room.erl: is_visitor/2 fix - use get_role |