X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fadmin.php;h=39677fb386f774e39b55651de7a5f752d09f6a29;hb=ce399928759320a29d9bfe47e60e607fe88408d9;hp=886d7a4d9df77e5af7b40663bbf4c43c9cd86bbc;hpb=a4104d7c17242c5f583891df7ed1f10f3ca94de2;p=friendica.git diff --git a/mod/admin.php b/mod/admin.php index 886d7a4d9d..39677fb386 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -121,10 +121,10 @@ function admin_content(&$a) { /** * Side bar links */ - $aside = Array(); + $aside_tools = Array(); // array( url, name, extra css classes ) // not part of $aside to make the template more adjustable - $asidesubpages = Array( + $aside_sub = Array( 'site' => Array($a->get_baseurl(true)."/admin/site/", t("Site") , "site"), 'users' => Array($a->get_baseurl(true)."/admin/users/", t("Users") , "users"), 'plugins'=> Array($a->get_baseurl(true)."/admin/plugins/", t("Plugins") , "plugins"), @@ -138,7 +138,7 @@ function admin_content(&$a) { /* get plugins admin page */ $r = q("SELECT `name` FROM `addon` WHERE `plugin_admin`=1 ORDER BY `name`"); - $aside['plugins_admin']=Array(); + $aside_tools['plugins_admin']=Array(); foreach ($r as $h){ $plugin =$h['name']; $aside['plugins_admin'][] = Array($a->get_baseurl(true)."/admin/plugins/".$plugin, $plugin, "plugin"); @@ -146,14 +146,14 @@ function admin_content(&$a) { $a->plugins_admin[] = $plugin; } - $aside['logs'] = Array($a->get_baseurl(true)."/admin/logs/", t("Logs"), "logs"); - $aside['diagnostics_probe'] = Array($a->get_baseurl(true).'/probe/', t('probe address'), 'probe'); - $aside['diagnostics_webfinger'] = Array($a->get_baseurl(true).'/webfinger/', t('check webfinger'), 'webfinger'); + $aside_tools['logs'] = Array($a->get_baseurl(true)."/admin/logs/", t("Logs"), "logs"); + $aside_tools['diagnostics_probe'] = Array($a->get_baseurl(true).'/probe/', t('probe address'), 'probe'); + $aside_tools['diagnostics_webfinger'] = Array($a->get_baseurl(true).'/webfinger/', t('check webfinger'), 'webfinger'); $t = get_markup_template("admin_aside.tpl"); $a->page['aside'] .= replace_macros( $t, array( - '$admin' => $aside, - '$subpages' => $asidesubpages, + '$admin' => $aside_tools, + '$subpages' => $aside_sub, '$admtxt' => t('Admin'), '$plugadmtxt' => t('Plugin Features'), '$logtxt' => t('Logs'), @@ -229,12 +229,69 @@ function admin_page_federation(&$a) { $platforms = array('Diaspora', 'Friendica', '%%red%%', 'Hubzilla', 'GNU Social', 'StatusNet'); $counts = array(); foreach ($platforms as $p) { - // get a totaö count for the platform, the name and version of the + // get a total count for the platform, the name and version of the // highest version and the protocol tpe - $c = q('select count(*), platform, network, version from gserver where platform like "'.$p.'" and last_contact > last_failure order by version asc;'); + $c = q('select count(*), platform, network, version from gserver + where platform like "'.$p.'" and last_contact > last_failure + order by version asc;'); // what versions for that platform do we know at all? // again only the active nodes - $v = q('select count(*), version from gserver where last_contact > last_failure and platform like "'.$p.'" group by version order by version;'); + $v = q('select count(*), version from gserver + where last_contact > last_failure and platform like "'.$p.'" + group by version + order by version;'); + // + // clean up version numbers + // + // 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 + if ($p=='Diaspora') { + $newV = array(); + $newVv = array(); + foreach($v as $vv) { + $newVC = $vv['count(*)']; + $newVV = $vv['version']; + $posDash = strpos($newVV, '-'); + if ($posDash) + $newVV = substr($newVV, 0, $posDash); + if (isset($newV[$newVV])) + { + $newV[$newVV] += $newVC; + } else { + $newV[$newVV] = $newVC; + } + } + foreach ($newV as $key => $value) { + array_push($newVv, array('count(*)'=>$value, 'version'=>$key)); + } + $v = $newVv; + } + // early friendica versions have the format x.x.xxxx where xxxx is the + // DB version stamp; those should be operated out and versions be + // conbined + if ($p=='Friendica') { + $newV = array(); + $newVv = array(); + foreach ($v as $vv) { + $newVC = $vv['count(*)']; + $newVV = $vv['version']; + $lastDot = strrpos($newVV,'.'); + $len = strlen($newVV)-1; + if ($lastDot == $len-4) + $newVV = substr($newVV, 0, $lastDot); + if (isset($newV[$newVV])) + { + $newV[$newVV] += $newVC; + } else { + $newV[$newVV] = $newVC; + } + } + foreach ($newV as $key => $value) { + array_push($newVv, array('count(*)'=>$value, 'version'=>$key)); + } + $v = $newVv; + } // the 3rd array item is needed for the JavaScript graphs as JS does // not like some characters in the names of variables... $counts[$p]=array($c[0], $v, str_replace(array(' ','%'),'',$p));