Commit 80234aa2 authored by David Morley's avatar David Morley

add new rows to db, use them and note if folks are on the current master in green

parent 8728c32e
......@@ -3,6 +3,18 @@
//* Copyright (c) 2011, David Morley. This file is licensed under the Affero General Public License version 3 or later. See the COPYRIGHT file. */
include('config.php');
//get master code version
$mv = curl_init();
curl_setopt($mv, CURLOPT_URL, "https://raw.github.com/diaspora/diaspora/master/config/defaults.yml");
curl_setopt($mv, CURLOPT_POST, 0);
curl_setopt($mv, CURLOPT_HEADER, 0);
curl_setopt($mv, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($mv, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($mv, CURLOPT_NOBODY, 0);
$outputmv = curl_exec($mv);
curl_close($mv);
preg_match('/number: (.*?)\n/',$outputmv,$version);
$masterversion = trim($version[1], '"');
$dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass");
$dbh2 = pg_connect("dbname=$pgdb user=$pguser password=$pgpass");
if (!$dbh) {
......@@ -93,7 +105,8 @@ $gitdate = trim($xgitdate[1]);
preg_match('/X-Git-Revision: (.*?)\n/',$outputssl,$xgitrev);
$gitrev = trim($xgitrev[1]);
preg_match('/X-Diaspora-Version: (.*?)\n/',$outputssl,$xdver);
$dver = trim($xdver[1]);
$dverr = split("-",trim($xdver[1]));
$dver = $dverr[0];
preg_match('/X-Runtime: (.*?)\n/',$outputssl,$xruntime);
$runtime = trim($xruntime[1]);
preg_match('/Server: (.*?)\n/',$outputssl,$xserver);
......@@ -112,7 +125,8 @@ $gitdate = trim($xgitdate[1]);
preg_match('/X-Git-Revision: (.*?)\n/',$output,$xgitrev);
$gitrev = trim($xgitrev[1]);
preg_match('/X-Diaspora-Version: (.*?)\n/',$output,$xdver);
$dver = trim($xdver[1]);
$dverr = split("-",trim($xdver[1]));
$dver = $dverr[0];
preg_match('/X-Runtime: (.*?)\n/',$output,$xruntime);
$runtime = trim($xruntime[1]);
preg_match('/Server: (.*?)\n/',$output,$xserver);
......@@ -246,7 +260,10 @@ $pingdomdate = date('Y-m-d H:i:s');
$timenow = date('Y-m-d H:i:s');
$sql = "UPDATE pods SET Hgitdate='$gitdate', Hencoding='$encoding', secure='$secure', hidden='$hidden', Hruntime='$runtime', Hgitref='$gitrev', ip='$ipnum', ipv6='$ipv6', monthsmonitored='$months',
uptimelast7='$uptime', status='$live', dateLaststats='$pingdomdate', dateUpdated='$timenow', responsetimelast7='$responsetime', score='$score', adminrating='$adminrating', country='$country', city='$city',
state='$state', lat='$lat', long='$long', postalcode='$postalcode', connection='$dver', whois='$whois', userrating='$userrating' WHERE domain='$domain'";
state='$state', lat='$lat', long='$long', postalcode='$postalcode', connection='$dver', whois='$whois', userrating='$userrating', longversion='$xdver[1]', shortversion='$dver',
masterversion='$masterversion'
WHERE
domain='$domain'";
if ($_GET["debug"] == "true") {echo $sql;}
$result = pg_query($dbh, $sql);
if (!$result) {
......
......@@ -7,6 +7,7 @@
<th>Live Status<a class="tipsy" title="Up or Down according to Pingdom">?</a></th>
<th>Last Code Pull<a class="tipsy" title="Because the alpha is updated everyday pods with old software will not work correcly with pods with new software. This is the date the p
od last updated from the main Diaspora code.">?</a></th>
<th>Version<a class="tipsy" title="Version of Diaspora this pod runs">?</a></th>
<th>Uptime<a class="tipsy" title="Percent of the time the pod is online for <?php echo date("F") ?>.">?</a></th>
<th>Months<a class="tipsy" title="How many months has this pod been online? Click number for more history.">?</a></th>
<th>Rating<a class="tipsy" title="User and Admin rating for this pod.">?</a></th>
......@@ -39,8 +40,16 @@ if ($row["secure"] == "true") {$method = "https://";$class="green";$tip="This po
//if ($tt == "3") {echo "<tr rowspan=9><td></td></tr>";}
echo "<tr><td><div title='$tip' class='tipsy'><a class='$class' target='new' href='". $method . $row["domain"] ."'>" . $method . $row["domain"] . "</a></div></td>";
echo "<td>" . $row["status"] . "</td>";
echo "<td><div class='tipsy' title='Diaspora Version ".$row["connection"]."\n\r Git Revision ".$row["hgitref"]."'><div id='".$row["hgitdate"]."' class='utc-timestamp'>" . strtotime($row["hgitdate"]) .
"</div></div></td>";
echo "<td><div id='".$row["hgitdate"]."' class='utc-timestamp'>" . strtotime($row["hgitdate"]) .
"</div></td>";
if (stristr($row["shortversion"],'pre')) {$version=$row["shortversion"];$pre = "This pod runs pre release development code";} elseif (!$row["shortversion"])
{$version="unknown";$pre = "This pod runs
unknown code";}
else
{$version=$row["shortversion"];$pre="This pod runs production code";}
if ($row["shortversion"] == $row["masterversion"] && $row["shortversion"] != "") {$classver = "green";} else {$classver = "black";}
echo "<td class='$classver'><div title='{$pre} codename: {$row["longversion"]} master version is: {$row["masterversion"]}' class='tipsy'>{$version}</div></td>";
echo "<td>" . $row["uptimelast7"] . "</td>";
if (strpos($row["pingdomurl"], "pingdom.com")) {$moreurl = $row["pingdomurl"];} else {$moreurl = "http://api.uptimerobot.com/getMonitors?format=json&customUptimeRatio=7-30-60-90&apiKey=".$row["pingdomurl"];}
echo "<td><div title='Last Check ".$row["dateupdated"]."' class='tipsy'><a target='new' href='".$moreurl."'>" . $row["monthsmonitored"] . "</a></div></td>";
......
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