Added statistics

This commit is contained in:
Michael 2017-12-19 07:39:21 +00:00
parent ddc25583be
commit 2b50f001b9
3 changed files with 11 additions and 4 deletions

View file

@ -548,15 +548,17 @@ function admin_page_federation(App $a)
);
$counts = array();
$total = 0;
$users = 0;
foreach ($platforms as $p) {
// get a total count for the platform, the name and version of the
// highest version and the protocol tpe
$c = q('SELECT COUNT(*) AS `total`, ANY_VALUE(`platform`) AS `platform`,
$c = q('SELECT COUNT(*) AS `total`, SUM(`registered-users`) AS `users`, ANY_VALUE(`platform`) AS `platform`,
ANY_VALUE(`network`) AS `network`, MAX(`version`) AS `version` FROM `gserver`
WHERE `platform` LIKE "%s" AND `last_contact` >= `last_failure`
ORDER BY `version` ASC;', $p);
$total = $total + $c[0]['total'];
$total += $c[0]['total'];
$users += $c[0]['users'];
// what versions for that platform do we know at all?
// again only the active nodes
@ -648,7 +650,7 @@ function admin_page_federation(App $a)
'$autoactive' => Config::get('system', 'poco_completion'),
'$counts' => $counts,
'$version' => FRIENDICA_VERSION,
'$legendtext' => sprintf(t('Currently this node is aware of %d nodes from the following platforms:'), $total),
'$legendtext' => sprintf(t('Currently this node is aware of %d nodes with %d registered users from the following platforms:'), $total, $users),
'$baseurl' => System::baseUrl(),
));
}

View file

@ -909,6 +909,11 @@ class PortableContact
if (!$failure) {
// This will be too low, but better than no value at all.
$registered_users = dba::count('gcontact', ['server_url' => normalise_link($server_url)]);
// Every server has got an admin account at least
if ($registered_users == 0) {
$registered_users = 1;
}
}
// Look for poco

View file

@ -10,7 +10,7 @@
<ul>
{{foreach $counts as $c}}
{{if $c[0]['total'] > 0}}
<li>{{$c[0]['platform']}} ({{$c[0]['total']}})</li>
<li>{{$c[0]['platform']}} ({{$c[0]['total']}}/{{$c[0]['users']}})</li>
{{/if}}
{{/foreach}}
</ul>