Commit 5d63bcda authored by David Morley's avatar David Morley Committed by GitHub

WIP better delete (#127)

* better delete

* enum q

* enum

* Delete updated (#134)

* fix for some really old and incompatable pods - this should be done a… (#131)

* fix for some really old and incompatable pods - this should be done at some point also using the data from the checks table

* socialhome not pulling version code properly, update location for that

* 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

* oops

* Remove temporary RedBean assignment fix, as corrected upstream by using partial beans.
see https://github.com/gabordemooij/redbean/issues/547

* Use enum for pod status.
parent 47a36f1b
......@@ -18,6 +18,7 @@ define('PODUPTIME', microtime(true));
// Set up global DB connection.
R::setup("pgsql:host={$pghost};dbname={$pgdb}", $pguser, $pgpass, true);
R::testConnection() || die('Error in DB connection');
R::usePartialBeans(true);
if ($_format === 'georss') {
echo <<<EOF
......
{
"require": {
"noplanman/xec": "0.1.0",
"gabordemooij/redbean": "^4.3",
"jaybizzle/crawler-detect" :"1.*"
"gabordemooij/redbean": "^5.0",
"jaybizzle/crawler-detect" :"1.*",
"commerceguys/enum": "^1.0"
},
"autoload": {
"classmap": ["lib"]
}
}
......@@ -4,21 +4,58 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "bc5abd96addbeeb7bbb644b518cbb065",
"content-hash": "f9ad6b81330128ff4847301b4835b7c2",
"content-hash": "b753491dc03e2084e9587d0bbafad98c",
"packages": [
{
"name": "commerceguys/enum",
"version": "v1.0",
"source": {
"type": "git",
"url": "https://github.com/commerceguys/enum.git",
"reference": "1d9db2dbeb1a02500e7a14589ae2f9cb402c5c95"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/commerceguys/enum/zipball/1d9db2dbeb1a02500e7a14589ae2f9cb402c5c95",
"reference": "1d9db2dbeb1a02500e7a14589ae2f9cb402c5c95",
"shasum": ""
},
"require": {
"php": ">=5.4.0"
},
"require-dev": {
"phpunit/phpunit": "~4.0"
},
"type": "library",
"autoload": {
"psr-4": {
"CommerceGuys\\Enum\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Bojan Zivanovic"
}
],
"description": "A PHP 5.4+ enumeration library.",
"time": "2015-02-27T21:36:56+00:00"
},
{
"name": "gabordemooij/redbean",
"version": "v4.3.3",
"version": "v5.0",
"source": {
"type": "git",
"url": "https://github.com/gabordemooij/redbean.git",
"reference": "1c7ec69850e9f7966ff7feb87b01d8f43a9753d3"
"reference": "44229acdf493e2229c1e33e3add211f23c05ee4d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/gabordemooij/redbean/zipball/1c7ec69850e9f7966ff7feb87b01d8f43a9753d3",
"reference": "1c7ec69850e9f7966ff7feb87b01d8f43a9753d3",
"url": "https://api.github.com/repos/gabordemooij/redbean/zipball/44229acdf493e2229c1e33e3add211f23c05ee4d",
"reference": "44229acdf493e2229c1e33e3add211f23c05ee4d",
"shasum": ""
},
"require": {
......@@ -46,27 +83,28 @@
"keywords": [
"orm"
],
"time": "2016-10-03 21:25:17"
"time": "2017-10-19T21:38:38+00:00"
},
{
"name": "jaybizzle/crawler-detect",
"version": "v1.2.36",
"version": "v1.2.61",
"source": {
"type": "git",
"url": "https://github.com/JayBizzle/Crawler-Detect.git",
"reference": "186cdc021f972a7e06963a84ef692d75f5b325c6"
"reference": "9f22764fa72f6a30211fe16cf28a1f43642136de"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/JayBizzle/Crawler-Detect/zipball/186cdc021f972a7e06963a84ef692d75f5b325c6",
"reference": "186cdc021f972a7e06963a84ef692d75f5b325c6",
"url": "https://api.github.com/repos/JayBizzle/Crawler-Detect/zipball/9f22764fa72f6a30211fe16cf28a1f43642136de",
"reference": "9f22764fa72f6a30211fe16cf28a1f43642136de",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"require-dev": {
"phpunit/phpunit": "4.*"
"phpunit/phpunit": "4.8.*",
"satooshi/php-coveralls": "1.*"
},
"type": "library",
"autoload": {
......@@ -94,7 +132,7 @@
"crawlerdetect",
"php crawler detect"
],
"time": "2017-03-03 21:13:00"
"time": "2018-03-19T20:27:17+00:00"
},
{
"name": "noplanman/xec",
......@@ -146,7 +184,7 @@
"shell",
"timeout"
],
"time": "2017-03-12 19:16:23"
"time": "2017-03-12T19:16:23+00:00"
}
],
"packages-dev": [],
......
......@@ -29,6 +29,7 @@ if (!filter_var(gethostbyname($_domain), FILTER_VALIDATE_IP)) {
// Set up global DB connection.
R::setup("pgsql:host={$pghost};dbname={$pgdb}", $pguser, $pgpass, true);
R::testConnection() || die('Error in DB connection');
R::usePartialBeans(true);
try {
$pods = R::getAll('
......@@ -57,11 +58,6 @@ foreach ($pods as $pod) {
$p['token'] = $uuid;
$p['tokenexpire'] = date('Y-m-d H:i:s', $expire);
// @todo Temporary fix! https://github.com/gabordemooij/redbean/issues/547
foreach ($p->getProperties() as $key => $value) {
$p[$key] = $value;
}
R::store($p);
} catch (\RedBeanPHP\RedException $e) {
die('Error in SQL query: ' . $e->getMessage());
......@@ -110,11 +106,6 @@ if (stristr($outputssl, 'openRegistrations')) {
$p['podmin_notify'] = $_podmin_notify;
$p['publickey'] = $publickey;
// @todo Temporary fix! https://github.com/gabordemooij/redbean/issues/547
foreach ($p->getProperties() as $key => $value) {
$p[$key] = $value;
}
R::store($p);
} catch (\RedBeanPHP\RedException $e) {
die('Error in SQL query: ' . $e->getMessage());
......
......@@ -18,6 +18,7 @@ define('PODUPTIME', microtime(true));
// Set up global DB connection.
R::setup("pgsql:host={$pghost};dbname={$pgdb}", $pguser, $pgpass, true);
R::testConnection() || die('Error in DB connection');
R::usePartialBeans(true);
try {
$pod = R::getRow('
......@@ -32,7 +33,12 @@ try {
if ($_format === 'json') {
echo json_encode($pod);
} else {
echo 'Status: ' . $pod['status'] . '<br>';
if ($pod['status'] === PodStatus::Up) {
echo 'Status: Up<br>';
}
if ($pod['status'] === PodStatus::Down) {
echo 'Status: Down<br>';
}
echo 'Last Git Pull: ' . $pod['hgitdate'] . '<br>';
echo 'Uptime This Month ' . $pod['uptimelast7'] . '<br>';
echo 'Months Monitored: ' . $pod['monthsmonitored'] . '<br>';
......
<?php
use RedBeanPHP\R;
use CommerceGuys\Enum\AbstractEnum;
// Required parameters.
($_domain = $_GET['domain'] ?? null) || die('no pod domain given');
......@@ -17,12 +18,6 @@ $_podmin_notify = $_GET['podmin_notify'] ?? 0;
require_once __DIR__ . '/../vendor/autoload.php';
require_once __DIR__ . '/../config.php';
define('PODUPTIME', microtime(true));
// Set up global DB connection.
R::setup("pgsql:host={$pghost};dbname={$pgdb}", $pguser, $pgpass, true);
R::testConnection() || die('Error in DB connection');
try {
$pod = R::findOne('pods', 'domain = ?', [$_domain]);
$pod || die('domain not found');
......@@ -35,8 +30,35 @@ $pod['tokenexpire'] >= date('Y-m-d H:i:s') || die('token expired');
// Delete and exit.
if ('delete' === $_action) {
R::trash($pod);
die('pod removed from DB');
try {
$pod['status'] = PodStatus::User_Deleted;
R::store($pod);
} catch (\RedBeanPHP\RedException $e) {
die('Error in SQL query: ' . $e->getMessage());
}
die('pod deleted');
}
// Pause and exit.
if ('pause' === $_action) {
try {
$pod['status'] = PodStatus::Paused;
R::store($pod);
} catch (\RedBeanPHP\RedException $e) {
die('Error in SQL query: ' . $e->getMessage());
}
die('pod paused');
}
// Un-Pause and exit.
if ('unpause' === $_action) {
try {
$pod['status'] = PodStatus::Recheck;
R::store($pod);
} catch (\RedBeanPHP\RedException $e) {
die('Error in SQL query: ' . $e->getMessage());
}
die('pod unpaused');
}
// Save and exit.
......@@ -49,11 +71,6 @@ if ('save' === $_action) {
$pod['podmin_statement'] = $_podmin_statement;
$pod['podmin_notify'] = $_podmin_notify;
// @todo Temporary fix for RedBean property handling, hope this gets fixed soon!
foreach ($pod->getProperties() as $key => $value) {
$pod[$key] = $value;
}
R::store($pod);
} catch (\RedBeanPHP\RedException $e) {
die('Error in SQL query: ' . $e->getMessage());
......@@ -69,23 +86,38 @@ if ('save' === $_action) {
}
// Forms.
?>
Authorized to edit <b><?php echo $_domain; ?></b> until <?php echo $pod['tokenexpire']; ?><br>
<form action="edit.php" method="get">
<form>
<input type="hidden" name="edit">
<input type="hidden" name="domain" value="<?php echo $_domain; ?>">
<input type="hidden" name="token" value="<?php echo $_token; ?>">
<label>Email <input type="text" size="20" name="email" value="<?php echo $pod['email']; ?>"></label><br>
<label>Podmin Statement (You can use HTML to include links to your terms and policies and information about your pod you wish to share with users.) <br><textarea cols="100" rows="7" name="podmin_statement"><?php echo $pod['podmin_statement']; ?></textarea></label><br>
<label>Email <input type="text" size="40" name="email" value="<?php echo $pod['email']; ?>"></label><br>
<label>Podmin Statement (You can use HTML to include links to your terms and policies and information about your pod you wish to share with users.) <br><textarea cols="150" rows="10" name="podmin_statement"><?php echo $pod['podmin_statement']; ?></textarea></label><br>
<label>Weight <input type="text" size="2" name="weight" value="<?php echo $pod['weight']; ?>"> This lets you weight your pod lower on the list if you have too much traffic coming in, 10 is the norm use lower to move down the list.</label><br>
<label>Notify if pod falls to hidden status? <input type="checkbox" name="podmin_notify" <?php echo $pod['podmin_notify'] ? 'checked' : ''; ?> ></label><br>
<input type="submit" name="action" value="save">
</form>
<br>
<br>Your pod status is currently: <?php echo PodStatus::getKey((int)$pod['status']); ?>
<br>
<br>
<form action="edit.php" method="get">
<form>
<input type="hidden" name="edit">
<input type="hidden" name="domain" value="<?php echo $_domain; ?>">
<input type="hidden" name="token" value="<?php echo $_token; ?>">
<input type="submit" name="action" value="delete">
</form>
<form>
<input type="hidden" name="edit">
<input type="hidden" name="domain" value="<?php echo $_domain; ?>">
<input type="hidden" name="token" value="<?php echo $_token; ?>">
<input type="submit" name="action" value="pause">
</form>
<form>
<input type="hidden" name="edit">
<input type="hidden" name="domain" value="<?php echo $_domain; ?>">
<input type="hidden" name="token" value="<?php echo $_token; ?>">
WARNING: This can not be undone, you will need to add your pod again if you want back on list: <input type="submit" name="action" value="delete">
<input type="submit" name="action" value="unpause">
</form>
<?php
......@@ -16,6 +16,7 @@ define('PODUPTIME', microtime(true));
// Set up global DB connection.
R::setup("pgsql:host={$pghost};dbname={$pgdb}", $pguser, $pgpass, true);
R::testConnection() || die('Error in DB connection');
R::usePartialBeans(true);
try {
$pod = R::findOne('pods', 'domain = ?', [$_domain]);
......@@ -26,7 +27,7 @@ try {
// Set up common variables.
$uuid = md5(uniqid($_domain, true));
$link = sprintf('https://%1$s/db/edit.php?domain=%2$s&token=%3$s', $_SERVER['HTTP_HOST'], $_domain, $uuid);
$link = sprintf('https://%1$s/?edit&domain=%2$s&token=%3$s', $_SERVER['HTTP_HOST'], $_domain, $uuid);
$headers = ['From: ' . $adminemail];
$message_lines = [];
......@@ -53,11 +54,6 @@ try {
$pod['token'] = $uuid;
$pod['tokenexpire'] = date('Y-m-d H:i:s', $expire);
// @todo Temporary fix! https://github.com/gabordemooij/redbean/issues/547
foreach ($pod->getProperties() as $key => $value) {
$pod[$key] = $value;
}
R::store($pod);
} catch (\RedBeanPHP\RedException $e) {
die('Error in SQL query: ' . $e->getMessage());
......
......@@ -20,6 +20,7 @@ define('PODUPTIME', microtime(true));
// Set up global DB connection.
R::setup("pgsql:host={$pghost};dbname={$pgdb}", $pguser, $pgpass, true);
R::testConnection() || die('Error in DB connection');
R::usePartialBeans(true);
try {
$pod = R::getRow('SELECT id, email FROM pods WHERE domain = ?', [$_domain]);
......
CREATE INDEX idx_clicks ON clicks (domain);
UPDATE pods SET status=0 WHERE status = 'Down';
UPDATE pods SET status=1 WHERE status = 'Up';
/*
0 = Down
1 = Up
2 = Recheck
3 = Paused
4 = System Deleted
5 = User Deleted
*/
ALTER TABLE pods ALTER COLUMN status TYPE smallint USING status::smallint;
......@@ -11,13 +11,15 @@ define('PODUPTIME', microtime(true));
// Set up global DB connection.
R::setup("pgsql:host={$pghost};dbname={$pgdb}", $pguser, $pgpass, true);
R::testConnection() || die('Error in DB connection');
R::usePartialBeans(true);
$softwares = [
'diaspora' => ['url' => 'https://raw.githubusercontent.com/diaspora/diaspora/master/config/defaults.yml', 'regex' => '/number:.*"(.*)"/'],
'friendica' => ['url' => 'https://raw.githubusercontent.com/friendica/friendica/master/boot.php', 'regex' => '/define.*\'FRIENDICA_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/bower.json', '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.*"(.*)"/'],
'ganggo' => ['url' => 'https://raw.githubusercontent.com/ganggo/ganggo/master/package.json', 'regex' => '/"version": "(.*)"/'],
];
foreach ($softwares as $software => $details) {
......
......@@ -19,10 +19,11 @@ define('PODUPTIME', microtime(true));
// Set up global DB connection.
R::setup("pgsql:host={$pghost};dbname={$pgdb}", $pguser, $pgpass, true);
R::testConnection() || die('Error in DB connection');
R::usePartialBeans(true);
try {
$sql = '
SELECT domain, score, date_created, adminrating, weight, hidden, podmin_notify, email
SELECT domain, score, date_created, adminrating, weight, hidden, podmin_notify, email, masterversion, shortversion
FROM pods
';
......@@ -31,7 +32,8 @@ try {
$sql .= ' WHERE domain = ?';
$pods = R::getAll($sql, [$_domain]);
} elseif (PHP_SAPI === 'cli') {
$pods = R::getAll($sql);
$sql .= ' WHERE status < ?';
$pods = R::getAll($sql, [PodStatus::Paused]);
}
} catch (\RedBeanPHP\RedException $e) {
die('Error in SQL query: ' . $e->getMessage());
......@@ -46,6 +48,8 @@ foreach ($pods as $pod) {
$hiddennow = $pod['hidden'];
$email = $pod['email'];
$notify = $pod['podmin_notify'];
$masterv = $pod['masterversion'];
$shortv = $pod['shortversion'];
try {
$ratings = R::getAll('
......@@ -125,7 +129,7 @@ foreach ($pods as $pod) {
}
if ($jsonssl !== null) {
$status = 'Up';
$status = PodStatus::Up;
try {
$c = R::dispense('checks');
......@@ -158,7 +162,7 @@ foreach ($pods as $pod) {
$score -= 1;
$shortversion = '0.error';
$status = 'Down';
$status = PodStatus::Down;
}
_debug('Version code', $shortversion);
......@@ -228,6 +232,11 @@ foreach ($pods as $pod) {
}
_debug('Masterversion', $masterversion);
$masterversioncheck = explode('.',$masterversion);
$shortversioncheck = explode('.',$shortversion);
if (($masterversioncheck[1] - $shortversioncheck[1]) > 1) {
_debug('Outdated', 'Yes');$score -= 2;
}
$hidden = $score <= 70;
_debug('Hidden', $hidden ? 'yes' : 'no');
......@@ -244,6 +253,9 @@ foreach ($pods as $pod) {
$score = 100;
} elseif ($score < 0) {
$score = 0;
if ($masterv <> $shortv) {
$status = PodStatus::System_Deleted;
}
}
_debug('Score', $score);
$weightedscore = ($uptime + $score - (10 - $weight)) / 2;
......@@ -289,11 +301,6 @@ foreach ($pods as $pod) {
$p['dnssec'] = $dnssec;
$p['sslexpire'] = $sslexpire;
// @todo Temporary fix! https://github.com/gabordemooij/redbean/issues/547
foreach ($p->getProperties() as $key => $value) {
$p[$key] = $value;
}
R::store($p);
} catch (\RedBeanPHP\RedException $e) {
die('Error in SQL query: ' . $e->getMessage());
......
......@@ -20,6 +20,7 @@ define('PODUPTIME', microtime(true));
// Set up global DB connection.
R::setup("pgsql:host={$pghost};dbname={$pgdb}", $pguser, $pgpass, true);
R::testConnection() || die('Error in DB connection');
R::usePartialBeans(true);
try {
$r = R::dispense('rating_comments');
......
......@@ -27,7 +27,7 @@ CREATE TABLE pods (
active_users_monthly int,
local_posts int,
uptime_alltime numeric(5,2),
status text,
status smallint,
latency smallint,
service_facebook boolean,
service_twitter boolean,
......
......@@ -14,6 +14,7 @@ define('PODUPTIME', microtime(true));
// Set up global DB connection.
R::setup("pgsql:host={$pghost};dbname={$pgdb}", $pguser, $pgpass, true);
R::testConnection() || die('Error in DB connection');
R::usePartialBeans(true);
try {
if ($_domain) {
......
......@@ -10,6 +10,7 @@ define('PODUPTIME', microtime(true));
// Set up global DB connection.
R::setup("pgsql:host={$pghost};dbname={$pgdb}", $pguser, $pgpass, true);
R::testConnection() || die('Error in DB connection');
R::usePartialBeans(true);
// CloudFlare country code pull.
$country_code = $_SERVER['HTTP_CF_IPCOUNTRY'] ?? '';
......@@ -21,6 +22,7 @@ $cleanup = isset($_GET['cleanup']);
$statsview = isset($_GET['statsview']);
$podmin = isset($_GET['podmin']);
$podminedit = isset($_GET['podminedit']);
$edit = isset($_GET['edit']);
$simpleview = !($detailedview || $mapview || $cleanup || $podmin || $podminedit || $statsview);
?>
<!doctype html>
......@@ -129,6 +131,8 @@ $navs = [
include_once __DIR__ . '/podmin.php';
} elseif ($podminedit) {
include_once __DIR__ . '/podminedit.php';
} elseif ($edit) {
include_once __DIR__ . '/db/edit.php';
} elseif ($cleanup) {
include_once __DIR__ . '/cleanup.php';
} else {
......
<?php
use CommerceGuys\Enum\AbstractEnum;
final class PodStatus extends AbstractEnum
{
const Down = 0;
const Up = 1;
const Recheck = 2;
const Paused = 3;
const System_Deleted = 4;
const User_Deleted = 5;
}
......@@ -13,6 +13,7 @@ define('PODUPTIME', microtime(true));
// Set up global DB connection.
R::setup("pgsql:host={$pghost};dbname={$pgdb}", $pguser, $pgpass, true);
R::testConnection() || die('Error in DB connection');
R::usePartialBeans(true);
$sql = "
SELECT
......@@ -22,21 +23,10 @@ $sql = "
round(avg(online::INT),2)*100 AS uptime,
round(avg(latency),2) * 1000 AS latency,
round(avg(local_posts)) AS local_posts,
round(avg(comment_counts)) AS comment_counts,
fpp.manualclicks,
fpp.autoclicks
round(avg(comment_counts)) AS comment_counts
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 = ?
GROUP BY yymm, fpp.manualclicks, fpp.autoclicks
GROUP BY yymm
ORDER BY yymm
LIMIT 24
";
......@@ -140,28 +130,6 @@ try {
backgroundColor: "#FFD700",
borderWidth: 4,
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',
}
]
},
......
......@@ -12,6 +12,7 @@ define('PODUPTIME', microtime(true));
// Set up global DB connection.
R::setup("pgsql:host={$pghost};dbname={$pgdb}", $pguser, $pgpass, true);
R::testConnection() || die('Error in DB connection');
R::usePartialBeans(true);
?>
<html>
<head>
......
User-agent: *
Allow: /
User-agent: *
Disallow: /podstat.php
User-agent: SemrushBot
Disallow: /podstat.php
......@@ -9,9 +9,10 @@ try {
SELECT domain, masterversion, shortversion, softwarename, monthsmonitored, podmin_statement, score, signup, name, country, city, state, uptime_alltime, active_users_halfyear, active_users_monthly, service_facebook, service_twitter, service_tumblr, service_wordpress, service_xmpp
FROM pods
WHERE NOT hidden
AND status = ?
AND signup
ORDER BY weightedscore DESC
');
', [PodStatus::Up]);
} catch (\RedBeanPHP\RedException $e) {
die('Error in SQL query: ' . $e->getMessage());
}
......@@ -39,10 +40,9 @@ try {
$verdiff = str_replace('.', '', $pod['masterversion']) - str_replace('.', '', $pod['shortversion']);
$pod_name = htmlentities($pod['name'], ENT_QUOTES);
$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['uptime_alltime'],
$pod['score']
$pod['uptime_alltime']
);
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>';
......
......@@ -6,8 +6,9 @@ defined('PODUPTIME') || die();
try {
$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, status
FROM pods
WHERE uptime_alltime > 50
ORDER BY weightedscore DESC
');
} catch (\RedBeanPHP\RedException $e) {
......@@ -46,9 +47,9 @@ try {
<?php
foreach ($pods as $pod) {
$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']) {
$version = $pod['shortversion'];
......
......@@ -11,7 +11,8 @@ try {
WHERE NOT hidden
AND lat != ''
AND long != ''
");
AND status < ?
", [PodStatus::Recheck]);
} catch (\RedBeanPHP\RedException $e) {
die('Error in SQL query: ' . $e->getMessage());
}
......
......@@ -12,6 +12,7 @@ try {
sum(total_users) AS users,
round(avg(uptime_alltime),2) AS uptime
FROM pods
WHERE NOT hidden
GROUP BY softwarename
');
} 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