diff --git a/db/migration00001.sql b/db/migration00001.sql
index be77e2c46ce59ea0e38607c607e622dff28a2738..6f30264abf9194b18e6ca97331a309fdefbbaf58 100644
--- a/db/migration00001.sql
+++ b/db/migration00001.sql
@@ -1,4 +1,4 @@
-ALTER TABLE pods ADD podmin_statement text, ADD sslexpire timestamp, ADD dnssec boolean, ADD masterversion text, ADD shortversion text, ADD publickey text;
+ALTER TABLE pods ADD podmin_statement text, ADD sslexpire timestamp, ADD dnssec boolean, ADD masterversion text, ADD shortversion text, ADD publickey text, ADD podmin_notify boolean;
ALTER TABLE pods DROP Hgitdate, DROP Hgitref, DROP Hruntime, DROP Hencoding, DROP longversion, DROP ptr, DROP whois, DROP postalcode, DROP connection, DROP pingdomlast;
ALTER TABLE pods RENAME COLUMN pingdomurl TO stats_apikey;
diff --git a/db/pods_apiv1.sql b/db/pods_apiv1.sql
index a6275a0edb34f426feb3913f572af54cc731497d..8ccacbc4073cc88d5635981bd1265e55df43815f 100644
--- a/db/pods_apiv1.sql
+++ b/db/pods_apiv1.sql
@@ -21,6 +21,6 @@ ALTER TABLE pods_apiv1 ALTER COLUMN signup TYPE text USING signup::text;
ALTER TABLE pods_apiv1 ADD Hgitdate text, ADD Hgitref text, ADD Hruntime text, ADD Hencoding text, ADD longversion text, ADD ptr text, ADD whois text, ADD postalcode text, ADD connection text, ADD pingdomlast text;
-ALTER TABLE pods_apiv1 DROP terms, DROP sslexpire, DROP dnssec, DROP masterversion, DROP shortversion, DROP publickey;
+ALTER TABLE pods_apiv1 DROP podmin_statement, DROP sslexpire, DROP dnssec, DROP publickey, DROP podmin_notify;
UPDATE pods_apiv1 SET hgitdate = 'unsupported';
diff --git a/db/pull.php b/db/pull.php
index 691dc502f22dbfcb2a69a806108318d1b97c5997..2211077acbdaee9a607edb1d4c842474f4c2c220 100644
--- a/db/pull.php
+++ b/db/pull.php
@@ -13,10 +13,10 @@ $dbh || die('Error in connection: ' . pg_last_error());
//foreach pod check it and update db
if ($_domain) {
- $sql = 'SELECT domain,stats_apikey,score,date_created,adminrating,weight FROM pods WHERE domain = $1';
+ $sql = 'SELECT domain,score,date_created,adminrating,weight,hidden,podmin_notify,email FROM pods WHERE domain = $1';
$result = pg_query_params($dbh, $sql, [$_domain]);
} elseif (PHP_SAPI === 'cli') {
- $sql = 'SELECT domain,stats_apikey,score,date_created,adminrating,weight FROM pods';
+ $sql = 'SELECT domain,score,date_created,adminrating,weight,hidden,podmin_notify,email FROM pods';
$result = pg_query($dbh, $sql);
} else {
die('No valid input');
@@ -29,6 +29,9 @@ while ($row = pg_fetch_assoc($result)) {
$dateadded = $row['date_created'];
$admindb = (int) $row['adminrating'];
$weight = $row['weight'];
+ $hiddennow = $row['hidden'];
+ $email = $row['email'];
+ $notify = $row['podmin_notify'];
$sqlforr = 'SELECT admin,rating FROM rating_comments WHERE domain = $1';
$ratings = pg_query_params($dbh, $sqlforr, [$domain]);
$ratings || die('Error in SQL query2: ' . pg_last_error());
@@ -158,10 +161,12 @@ while ($row = pg_fetch_assoc($result)) {
$responsetime = pg_fetch_result($resultttl, 0);
$uptime = 0;
- $sqlonline = 'SELECT round(avg(online::int),2) * 100 AS online FROM checks WHERE domain = $1';
+ $sqlonline = 'SELECT avg(online::int) * 100 AS online FROM checks WHERE domain = $1';
$resultonline = pg_query_params($dbh, $sqlonline, [$domain]);
$resultonline || die('Error in SQL query resultchecks: ' . pg_last_error());
- $uptime = pg_fetch_result($resultonline, 0);
+ $uptime = round(pg_fetch_result($resultonline, 0),2);
+
+ _debug('Uptime', $uptime);
$sqlmasters = 'SELECT version FROM masterversions WHERE software = $1 ORDER BY date_checked LIMIT 1';
$resultmasters = pg_query_params($dbh, $sqlmasters, [$softwarename]);
@@ -172,6 +177,15 @@ while ($row = pg_fetch_assoc($result)) {
$hidden = $score <= 70;
_debug('Hidden', $hidden ? 'yes' : 'no');
+
+ if ($hiddennow === 'f' && $hidden && $notify === 't') {
+ $to = $email;
+ $headers = ['From: ' . $adminemail, 'Bcc: ' . $adminemail];
+ $subject = 'Monitoring notice from poduptime';
+ $message = 'Notice for ' . $domain . '. Your score fell to ' . $score . ' and your pod is now marked as hidden.';
+ @mail($to, $subject, $message, implode("\r\n", $headers));
+ _debug('Mail Notice', 'sent to '.$email);
+ }
if ($score > 100) {
$score = 100;
} elseif ($score < 0) {
diff --git a/db/tables.sql b/db/tables.sql
index 1a592666c6cff4998b8ac5bfe6cb3f3a83be5200..7aa6aab1864f77d0f6d156348a3bde2af309aaaf 100644
--- a/db/tables.sql
+++ b/db/tables.sql
@@ -38,6 +38,7 @@ CREATE TABLE pods (
publickey text,
tokenexpire timestamp,
podmin_statement text,
+ podmin_notify boolean,
sslexpire timestamp,
dnssec boolean,
comment_counts int,
diff --git a/index.php b/index.php
index 272477b4681cd8d0196ffa179c9e535eec1182d9..6972991f682913115580584a18cdd67f7c34ac8d 100644
--- a/index.php
+++ b/index.php
@@ -1,19 +1,19 @@
- Diaspora Pod Uptime Status - Find your new social home on a hosted pod
-
+ Open Source Social Network Pod Uptime Status
+
@@ -21,7 +21,7 @@ $simpleview = !($advancedview || $mapview || $cleanup || $podmin || $podminedi
-
+
@@ -34,7 +34,7 @@ $simpleview = !($advancedview || $mapview || $cleanup || $podmin || $podminedi