]> granicus.if.org Git - ejabberd/commitdiff
* src/ejabberd_check.erl: Detect correctly MSSQL and ODBC
authorBadlop <badlop@process-one.net>
Mon, 25 Aug 2008 12:08:22 +0000 (12:08 +0000)
committerBadlop <badlop@process-one.net>
Mon, 25 Aug 2008 12:08:22 +0000 (12:08 +0000)
configuration (EJAB-710)

SVN Revision: 1536

ChangeLog
src/ejabberd_check.erl

index 1da0b991d3011c02ed4fa5c37750c7b693b79fb8..0a6d1caf4ebf4aab1b301ed246ad526b6b76d233 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
 
        * src/mod_mud/mod_muc_room.erl: is_visitor/2 fix - use get_role
index 4436490e7d49f3586f5c92cb571f4d040faed6ff..260c54175ba1d57f37fda5cf13c02c9a3ce215d8 100644 (file)
 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) ->