Commit 1583addf authored by David Morley's avatar David Morley Committed by GitHub

some cleanup and fix the stats that just grind (#133)

* some cleanup and fix the stats that just grind

* limit the full page for now, so much dead pods

* add ganggo version pull

* remove unused item
parent a3663cb6
...@@ -18,6 +18,7 @@ $softwares = [ ...@@ -18,6 +18,7 @@ $softwares = [
'redmatrix' => ['url' => 'https://raw.githubusercontent.com/redmatrix/hubzilla/master/boot.php', 'regex' => '/define.*\'STD_VERSION\'.*\'(.*)\'/'], 'redmatrix' => ['url' => 'https://raw.githubusercontent.com/redmatrix/hubzilla/master/boot.php', 'regex' => '/define.*\'STD_VERSION\'.*\'(.*)\'/'],
'socialhome' => ['url' => 'https://raw.githubusercontent.com/jaywink/socialhome/master/socialhome/__init__.py', 'regex' => '/__version__ =.*"(.*)"/'], 'socialhome' => ['url' => 'https://raw.githubusercontent.com/jaywink/socialhome/master/socialhome/__init__.py', 'regex' => '/__version__ =.*"(.*)"/'],
'social-relay' => ['url' => 'https://raw.githubusercontent.com/jaywink/social-relay/master/social_relay/config.py', 'regex' => '/VERSION.*"(.*)"/'], 'social-relay' => ['url' => 'https://raw.githubusercontent.com/jaywink/social-relay/master/social_relay/config.py', 'regex' => '/VERSION.*"(.*)"/'],
'ganggo' => ['url' => 'https://raw.githubusercontent.com/ganggo/ganggo/master/package.json', 'regex' => '/"version": "(.*)"/'],
]; ];
foreach ($softwares as $software => $details) { foreach ($softwares as $software => $details) {
......
...@@ -22,21 +22,10 @@ $sql = " ...@@ -22,21 +22,10 @@ $sql = "
round(avg(online::INT),2)*100 AS uptime, round(avg(online::INT),2)*100 AS uptime,
round(avg(latency),2) * 1000 AS latency, round(avg(latency),2) * 1000 AS latency,
round(avg(local_posts)) AS local_posts, round(avg(local_posts)) AS local_posts,
round(avg(comment_counts)) AS comment_counts, round(avg(comment_counts)) AS comment_counts
fpp.manualclicks,
fpp.autoclicks
FROM checks FROM checks
LEFT JOIN LATERAL (
SELECT
count(manualclick) AS manualclicks,
count(autoclick) AS autoclicks
FROM clicks
WHERE checks.domain = clicks.domain
AND EXTRACT(MONTH FROM checks.date_checked) = EXTRACT(MONTH FROM clicks.date_clicked)
AND EXTRACT(YEAR FROM checks.date_checked) = EXTRACT(YEAR FROM clicks.date_clicked)
) AS fpp ON TRUE
WHERE domain = ? WHERE domain = ?
GROUP BY yymm, fpp.manualclicks, fpp.autoclicks GROUP BY yymm
ORDER BY yymm ORDER BY yymm
LIMIT 24 LIMIT 24
"; ";
...@@ -140,28 +129,6 @@ try { ...@@ -140,28 +129,6 @@ try {
backgroundColor: "#FFD700", backgroundColor: "#FFD700",
borderWidth: 4, borderWidth: 4,
pointHoverRadius: 6, pointHoverRadius: 6,
},
{
data: <?php echo json_encode(array_column($totals, 'manualclicks')); ?>,
label: 'Manual Clicks',
fill: false,
yAxisID: "r2",
borderColor: "#8A2BE2",
backgroundColor: "#8A2BE2",
borderWidth: 4,
pointHoverRadius: 6,
pointStyle: 'rect',
},
{
data: <?php echo json_encode(array_column($totals, 'autoclicks')); ?>,
label: 'Auto Clicks',
fill: false,
yAxisID: "r2",
borderColor: "#FFA07A",
backgroundColor: "#FFA07A",
borderWidth: 4,
pointHoverRadius: 6,
pointStyle: 'rect',
} }
] ]
}, },
......
User-agent: * User-agent: *
Allow: / Allow: /
User-agent: *
Disallow: /podstat.php
User-agent: SemrushBot
Disallow: /podstat.php
...@@ -39,10 +39,9 @@ try { ...@@ -39,10 +39,9 @@ try {
$verdiff = str_replace('.', '', $pod['masterversion']) - str_replace('.', '', $pod['shortversion']); $verdiff = str_replace('.', '', $pod['masterversion']) - str_replace('.', '', $pod['shortversion']);
$pod_name = htmlentities($pod['name'], ENT_QUOTES); $pod_name = htmlentities($pod['name'], ENT_QUOTES);
$tip = sprintf( $tip = sprintf(
'Uptime %2$s%% over %1$s months, score is %3$s out of 100.', 'Uptime %2$s%% over %1$s months.',
$pod['monthsmonitored'], $pod['monthsmonitored'],
$pod['uptime_alltime'], $pod['uptime_alltime']
$pod['score']
); );
echo '<tr><td><div title="' . $tip . '" data-toggle="tooltip" data-placement="bottom"><a class="text-success url" target="_self" href="/go.php?domain=' . $pod['domain'] . '">' . $pod['domain'] . '</a></div></td>'; echo '<tr><td><div title="' . $tip . '" data-toggle="tooltip" data-placement="bottom"><a class="text-success url" target="_self" href="/go.php?domain=' . $pod['domain'] . '">' . $pod['domain'] . '</a></div></td>';
......
...@@ -8,6 +8,7 @@ try { ...@@ -8,6 +8,7 @@ try {
$pods = R::getAll(' $pods = R::getAll('
SELECT domain, dnssec, podmin_statement, sslexpire, masterversion, shortversion, softwarename, monthsmonitored, score, signup, name, country, city, state, lat, long, uptime_alltime, active_users_halfyear, active_users_monthly, service_facebook, service_twitter, service_tumblr, service_wordpress, service_xmpp, latency, date_updated, ipv6, total_users, local_posts, comment_counts, stats_apikey, userrating SELECT domain, dnssec, podmin_statement, sslexpire, masterversion, shortversion, softwarename, monthsmonitored, score, signup, name, country, city, state, lat, long, uptime_alltime, active_users_halfyear, active_users_monthly, service_facebook, service_twitter, service_tumblr, service_wordpress, service_xmpp, latency, date_updated, ipv6, total_users, local_posts, comment_counts, stats_apikey, userrating
FROM pods FROM pods
WHERE uptime_alltime > 50
ORDER BY weightedscore DESC ORDER BY weightedscore DESC
'); ');
} catch (\RedBeanPHP\RedException $e) { } catch (\RedBeanPHP\RedException $e) {
...@@ -46,9 +47,9 @@ try { ...@@ -46,9 +47,9 @@ try {
<?php <?php
foreach ($pods as $pod) { foreach ($pods as $pod) {
$pod_name = htmlentities($pod['name'], ENT_QUOTES); $pod_name = htmlentities($pod['name'], ENT_QUOTES);
$tip = "\n Over {$pod['monthsmonitored']} months uptime is {$pod['uptime_alltime']}% and response time is {$pod['latency']}ms, last check on {$pod['date_updated']}. "; $tip = "\n Over {$pod['monthsmonitored']} months uptime is {$pod['uptime_alltime']}% and response time is {$pod['latency']}ms, last check on {$pod['date_updated']}. This site is SSL/TLS encrypted with a cert that expires: ' . $pod['sslexpire'] . '";
echo '<tr><td><a title="' . $tip . '" data-toggle="tooltip" data-placement="bottom" target="_self" href="/go.php?domain=' . $pod['domain'] . '">' . $pod['domain'] . '</a><span class="text-success" " data-toggle="tooltip" title="This site is SSL/TLS encrypted with a cert that expires: ' . $pod['sslexpire'] . '"> &#128274;</span></td>'; echo '<tr><td><a title="' . $tip . '" data-toggle="tooltip" data-placement="bottom" target="_self" href="/go.php?domain=' . $pod['domain'] . '">' . $pod['domain'] . '</a></td>';
if ($pod['shortversion'] > $pod['masterversion']) { if ($pod['shortversion'] > $pod['masterversion']) {
$version = $pod['shortversion']; $version = $pod['shortversion'];
......
...@@ -12,6 +12,7 @@ try { ...@@ -12,6 +12,7 @@ try {
sum(total_users) AS users, sum(total_users) AS users,
round(avg(uptime_alltime),2) AS uptime round(avg(uptime_alltime),2) AS uptime
FROM pods FROM pods
WHERE NOT hidden
GROUP BY softwarename GROUP BY softwarename
'); ');
} catch (\RedBeanPHP\RedException $e) { } catch (\RedBeanPHP\RedException $e) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment