From 2b50f001b9ecbd4ecfbf4a3585bf7f048dad2579 Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 19 Dec 2017 07:39:21 +0000 Subject: [PATCH] Added statistics --- mod/admin.php | 8 +++++--- src/Protocol/PortableContact.php | 5 +++++ view/templates/admin/federation.tpl | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/mod/admin.php b/mod/admin.php index 8a5ec1f1a8..f5bd1d4f59 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -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(), )); } diff --git a/src/Protocol/PortableContact.php b/src/Protocol/PortableContact.php index 6a017120ab..aee7b2f773 100644 --- a/src/Protocol/PortableContact.php +++ b/src/Protocol/PortableContact.php @@ -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 diff --git a/view/templates/admin/federation.tpl b/view/templates/admin/federation.tpl index ee33df09b2..6904be6b92 100644 --- a/view/templates/admin/federation.tpl +++ b/view/templates/admin/federation.tpl @@ -10,7 +10,7 @@ -- 2.39.5