]> git.mxchange.org Git - friendica.git/commitdiff
Added statistics
authorMichael <heluecht@pirati.ca>
Tue, 19 Dec 2017 07:39:21 +0000 (07:39 +0000)
committerMichael <heluecht@pirati.ca>
Tue, 19 Dec 2017 07:39:21 +0000 (07:39 +0000)
mod/admin.php
src/Protocol/PortableContact.php
view/templates/admin/federation.tpl

index 8a5ec1f1a810e903de8f981a394a221ee63e9dd7..f5bd1d4f590b30c6a68de4c917f0f46c5705f011 100644 (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(),
        ));
 }
index 6a017120abd18af231588d2f2c810683443c719c..aee7b2f773cb6ccbbe827ee30591aabd700b37f3 100644 (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
index ee33df09b279ea32efe17e6d9e607b2da3153ccf..6904be6b921d56ae412a2282deae615adbad320e 100644 (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>