From: Michael Date: Mon, 7 Feb 2022 06:11:37 +0000 (+0000) Subject: Show detailled statistics per platform X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=bdba75ec473f070dc39455aad9a518b13c3d18b0;p=friendica.git Show detailled statistics per platform --- diff --git a/src/Module/Admin/Federation.php b/src/Module/Admin/Federation.php index 19f114942d..94b26f4617 100644 --- a/src/Module/Admin/Federation.php +++ b/src/Module/Admin/Federation.php @@ -74,8 +74,10 @@ class Federation extends BaseAdmin $users = 0; $month = 0; $halfyear = 0; + $posts = 0; $gservers = DBA::p("SELECT COUNT(*) AS `total`, SUM(`registered-users`) AS `users`, + SUM(IFNULL(`local-posts`, 0) + IFNULL(`local-comments`, 0)) AS `posts`, SUM(IFNULL(`active-month-users`, `active-week-users`)) AS `month`, SUM(IFNULL(`active-halfyear-users`, `active-week-users`)) AS `halfyear`, `platform`, ANY_VALUE(`network`) AS `network`, MAX(`version`) AS `version` @@ -85,6 +87,7 @@ class Federation extends BaseAdmin $users += $gserver['users']; $month += $gserver['month']; $halfyear += $gserver['halfyear']; + $posts += $gserver['posts']; $versionCounts = []; $versions = DBA::p("SELECT COUNT(*) AS `total`, `version` FROM `gserver` @@ -139,6 +142,7 @@ class Federation extends BaseAdmin $gserver['users'] += $counts[$platform][0]['users'] ?? 0; $gserver['month'] += $counts[$platform][0]['month'] ?? 0; $gserver['halfyear'] += $counts[$platform][0]['halfyear'] ?? 0; + $gserver['posts'] += $counts[$platform][0]['posts'] ?? 0; } if ($platform == 'friendica') { @@ -159,7 +163,17 @@ class Federation extends BaseAdmin ksort($versionCounts); } - $gserver['platform'] = $systems[$platform]['name']; + $gserver['platform'] = $systems[$platform]['name']; + $gserver['monthlbl'] = DI::l10n()->t('%d active users last month', $gserver['month']); + $gserver['halfyearlbl'] = DI::l10n()->t('%d active users last six month', $gserver['halfyear']); + $gserver['userslbl'] = DI::l10n()->t('%d registered users', $gserver['users']); + $gserver['postslbl'] = DI::l10n()->t('%d local posts', $gserver['posts']); + + if (($gserver['users'] > 0) && ($gserver['posts'] > 0)) { + $gserver['postsuserlbl'] = DI::l10n()->t('%d posts per user', $gserver['posts'] / $gserver['users']); + } else { + $gserver['postsuserlbl'] = ''; + } $counts[$platform] = [$gserver, $versionCounts, str_replace([' ', '%', '.'], '', $platform), $systems[$platform]['color']]; } diff --git a/view/lang/C/messages.po b/view/lang/C/messages.po index 9bd54a3101..24f06bce94 100644 --- a/view/lang/C/messages.po +++ b/view/lang/C/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: 2022.05-dev\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-02-07 05:22+0000\n" +"POT-Creation-Date: 2022-02-07 06:11+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -4699,7 +4699,7 @@ msgstr "" #: src/Module/Admin/Blocklist/Contact.php:94 #: src/Module/Admin/Blocklist/Server/Add.php:89 #: src/Module/Admin/Blocklist/Server/Index.php:78 -#: src/Module/Admin/Federation.php:174 src/Module/Admin/Item/Delete.php:64 +#: src/Module/Admin/Federation.php:188 src/Module/Admin/Item/Delete.php:64 #: src/Module/Admin/Logs/Settings.php:79 src/Module/Admin/Logs/View.php:83 #: src/Module/Admin/Queue.php:72 src/Module/Admin/Site.php:498 #: src/Module/Admin/Storage.php:138 src/Module/Admin/Summary.php:232 @@ -5113,22 +5113,47 @@ msgstr "" msgid "Other" msgstr "" -#: src/Module/Admin/Federation.php:131 src/Module/Admin/Federation.php:363 +#: src/Module/Admin/Federation.php:134 src/Module/Admin/Federation.php:377 msgid "unknown" msgstr "" +#: src/Module/Admin/Federation.php:167 +#, php-format +msgid "%d active users last month" +msgstr "" + +#: src/Module/Admin/Federation.php:168 +#, php-format +msgid "%d active users last six month" +msgstr "" + #: src/Module/Admin/Federation.php:169 +#, php-format +msgid "%d registered users" +msgstr "" + +#: src/Module/Admin/Federation.php:170 +#, php-format +msgid "%d local posts" +msgstr "" + +#: src/Module/Admin/Federation.php:173 +#, php-format +msgid "%d posts per user" +msgstr "" + +#: src/Module/Admin/Federation.php:183 msgid "" "This page offers you some numbers to the known part of the federated social " "network your Friendica node is part of. These numbers are not complete but " "only reflect the part of the network your node is aware of." msgstr "" -#: src/Module/Admin/Federation.php:175 src/Module/BaseAdmin.php:87 +#: src/Module/Admin/Federation.php:189 src/Module/BaseAdmin.php:87 msgid "Federation Statistics" msgstr "" -#: src/Module/Admin/Federation.php:179 +#: src/Module/Admin/Federation.php:193 #, php-format msgid "" "Currently this node is aware of %d nodes (%d active users last month, %d " diff --git a/view/templates/admin/federation.tpl b/view/templates/admin/federation.tpl index e80565fd1b..d99d72e5f9 100644 --- a/view/templates/admin/federation.tpl +++ b/view/templates/admin/federation.tpl @@ -10,7 +10,7 @@
    {{foreach $counts as $c}} {{if $c[0]['total'] > 0}} -
  • {{$c[0]['platform']}} ({{$c[0]['total']}} • {{$c[0]['month']}} • {{$c[0]['halfyear']}} • {{$c[0]['users']}})
  • +
  • {{$c[0]['platform']}} ({{$c[0]['total']}}/{{$c[0]['users']}})
  • {{/if}} {{/foreach}}
@@ -60,6 +60,17 @@ {{$c[0]['total']}} {{$c[0]['network']}} + + +
    + {{if $c[0]['month']}}
  • {{$c[0]['monthlbl']}}
  • {{/if}} + {{if $c[0]['halfyear']}}
  • {{$c[0]['halfyearlbl']}}
  • {{/if}} + {{if $c[0]['users']}}
  • {{$c[0]['userslbl']}}
  • {{/if}} + {{if $c[0]['posts']}}
  • {{$c[0]['postslbl']}}
  • {{/if}} + {{if $c[0]['postsuserlbl']}}
  • {{$c[0]['postsuserlbl']}}
  • {{/if}} +
+ +