Fix ODBC account counting (thanks to Artem Sh)(EJAB-1491)

This commit is contained in:
Badlop 2011-08-16 19:33:22 +02:00
parent 1ee6eae684
commit abebabc487
3 changed files with 10 additions and 6 deletions

View File

@ -162,7 +162,12 @@ get_local_stat(_Server, [], Name) when Name == "users/all-hosts/online" ->
end;
get_local_stat(_Server, [], Name) when Name == "users/all-hosts/total" ->
case catch mnesia:table_info(passwd, size) of
NumUsers = lists:foldl(
fun(Host, Total) ->
ejabberd_auth:get_vh_registered_users_number(Host)
+ Total
end, 0, ejabberd_config:get_global_option(hosts)),
case NumUsers of
{'EXIT', _Reason} ->
?STATERR("500", "Internal Server Error");
Users ->

View File

@ -232,10 +232,6 @@ list_users(LServer, [{prefix, Prefix},
users_number(LServer) ->
case element(1, ejabberd_config:get_local_option({odbc_server, LServer})) of
mysql ->
ejabberd_odbc:sql_query(
LServer,
"select table_rows from information_schema.tables where table_name='users'");
pgsql ->
case ejabberd_config:get_local_option({pgsql_users_number_estimate, LServer}) of
true ->

View File

@ -1648,7 +1648,10 @@ su_to_list({Server, User}) ->
get_stats(global, Lang) ->
OnlineUsers = mnesia:table_info(session, size),
RegisteredUsers = mnesia:table_info(passwd, size),
RegisteredUsers = lists:foldl(
fun(Host, Total) ->
ejabberd_auth:get_vh_registered_users_number(Host) + Total
end, 0, ejabberd_config:get_global_option(hosts)),
S2SConns = ejabberd_s2s:dirty_get_connections(),
S2SConnections = length(S2SConns),
S2SServers = length(lists:usort([element(2, C) || C <- S2SConns])),