From 350887f8923300a99cb403b0cfea5b14ce4efe8c Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Wed, 9 Nov 2016 14:25:51 +0100 Subject: [PATCH 1/4] prepare for Mastodon in the federation stats and include BlaBlaNet --- mod/admin.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mod/admin.php b/mod/admin.php index 287eff2725..b9c714f377 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -269,13 +269,15 @@ function admin_page_federation(&$a) { // off one % two of them are needed in the query // Add more platforms if you like, when one returns 0 known nodes it is not // displayed on the stats page. - $platforms = array('Friendica', 'Diaspora', '%%red%%', 'Hubzilla', 'GNU Social', 'StatusNet'); + $platforms = array('Friendica', 'Diaspora', '%%red%%', 'Hubzilla', 'BlaBlaNet', 'GNU Social', 'StatusNet', 'Mastodon'); $colors = array('Friendica' => '#ffc018', // orange from the logo - 'Diaspora' => '#a1a1a1', // logo is black and white, makes a gray + 'Diaspora' => '#a1a1a1', // logo is black and white, makes a gray '%%red%%' => '#c50001', // fire red from the logo 'Hubzilla' => '#43488a', // blue from the logo + 'BlaBlaNet' => '#3B5998', // blue from the navbar at blablanet-dot-com 'GNU Social'=> '#a22430', // dark red from the logo - 'StatusNet' => '#789240'); // the green from the logo (red and blue have already others + 'StatusNet' => '#789240', // the green from the logo (red and blue have already others + 'Mastodon' => '#1a9df9'); // blue from the Mastodon logo $counts = array(); $total = 0; From 32b2d9952bf74883b05ce58cf0a032fe39643d64 Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Sun, 13 Nov 2016 07:03:38 +0100 Subject: [PATCH 2/4] some platforms don't provide version information --- mod/admin.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mod/admin.php b/mod/admin.php index b9c714f377..2a70419852 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -285,14 +285,14 @@ function admin_page_federation(&$a) { // get a total count for the platform, the name and version of the // highest version and the protocol tpe $c = qu('SELECT COUNT(*) AS `total`, `platform`, `network`, `version` FROM `gserver` - WHERE `platform` LIKE "%s" AND `last_contact` > `last_failure` AND `version` != "" + WHERE `platform` LIKE "%s" AND `last_contact` > `last_failure` ORDER BY `version` ASC;', $p); $total = $total + $c[0]['total']; // what versions for that platform do we know at all? // again only the active nodes $v = qu('SELECT COUNT(*) AS `total`, `version` FROM `gserver` - WHERE `last_contact` > `last_failure` AND `platform` LIKE "%s" AND `version` != "" + WHERE `last_contact` > `last_failure` AND `platform` LIKE "%s" GROUP BY `version` ORDER BY `version`;', $p); From 772d33342c093fceb366e5aeb38ad097bcb8aa40 Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Sun, 13 Nov 2016 08:12:09 +0100 Subject: [PATCH 3/4] add unkown to empty version strings --- mod/admin.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/mod/admin.php b/mod/admin.php index 2a70419852..4dbdc377f4 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -299,6 +299,17 @@ function admin_page_federation(&$a) { // // clean up version numbers // + // some platforms do not provide version information, add a unkown there + // to the version string for the displayed list. + $newV = array(); + foreach ($v as $vv) { + if ($vv['version'] == '') { + $newV[] = array('total'=>$vv['total'], 'version'=>t('unknown')); + } else { + $newV[] = $vv; + } + } + $v = $newV; // in the DB the Diaspora versions have the format x.x.x.x-xx the last // part (-xx) should be removed to clean up the versions from the "head // commit" information and combined into a single entry for x.x.x.x From df3c776e1b73e5d3b3dddf7b2419762a63f1db2e Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Sun, 13 Nov 2016 09:03:22 +0100 Subject: [PATCH 4/4] shorter foreach loop --- mod/admin.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/mod/admin.php b/mod/admin.php index 4dbdc377f4..9eb86720df 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -301,15 +301,11 @@ function admin_page_federation(&$a) { // // some platforms do not provide version information, add a unkown there // to the version string for the displayed list. - $newV = array(); - foreach ($v as $vv) { - if ($vv['version'] == '') { - $newV[] = array('total'=>$vv['total'], 'version'=>t('unknown')); - } else { - $newV[] = $vv; + foreach ($v as $key => $value) { + if ($v[$key]['version'] == '') { + $v[$key] = array('total'=>$v[$key]['total'], 'version'=>t('unknown')); } } - $v = $newV; // in the DB the Diaspora versions have the format x.x.x.x-xx the last // part (-xx) should be removed to clean up the versions from the "head // commit" information and combined into a single entry for x.x.x.x