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;
|
end;
|
||||||
|
|
||||||
get_local_stat(_Server, [], Name) when Name == "users/all-hosts/total" ->
|
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} ->
|
{'EXIT', _Reason} ->
|
||||||
?STATERR("500", "Internal Server Error");
|
?STATERR("500", "Internal Server Error");
|
||||||
Users ->
|
Users ->
|
||||||
|
|
|
@ -232,10 +232,6 @@ list_users(LServer, [{prefix, Prefix},
|
||||||
|
|
||||||
users_number(LServer) ->
|
users_number(LServer) ->
|
||||||
case element(1, ejabberd_config:get_local_option({odbc_server, LServer})) of
|
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 ->
|
pgsql ->
|
||||||
case ejabberd_config:get_local_option({pgsql_users_number_estimate, LServer}) of
|
case ejabberd_config:get_local_option({pgsql_users_number_estimate, LServer}) of
|
||||||
true ->
|
true ->
|
||||||
|
|
|
@ -1648,7 +1648,10 @@ su_to_list({Server, User}) ->
|
||||||
|
|
||||||
get_stats(global, Lang) ->
|
get_stats(global, Lang) ->
|
||||||
OnlineUsers = mnesia:table_info(session, size),
|
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(),
|
S2SConns = ejabberd_s2s:dirty_get_connections(),
|
||||||
S2SConnections = length(S2SConns),
|
S2SConnections = length(S2SConns),
|
||||||
S2SServers = length(lists:usort([element(2, C) || C <- S2SConns])),
|
S2SServers = length(lists:usort([element(2, C) || C <- S2SConns])),
|
||||||
|
|
Loading…
Reference in New Issue