mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
Fix ODBC account counting (thanks to Artem Sh)(EJAB-1491)
This commit is contained in:
parent
1ee6eae684
commit
abebabc487
@ -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 ->
|
||||
|
@ -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 ->
|
||||
|
@ -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])),
|
||||
|
Loading…
Reference in New Issue
Block a user