Numbering YSFReflectors, showing only active within last 2 hours
This commit is contained in:
parent
f5db7ad19e
commit
305afe8f8c
2 changed files with 21 additions and 11 deletions
|
@ -113,9 +113,9 @@ function getYSFGatewayLog() {
|
||||||
$logLines = array();
|
$logLines = array();
|
||||||
if ($log = fopen(YSFGATEWAYLOGPATH."/".YSFGATEWAYLOGPREFIX."-".date("Y-m-d").".log", 'r')) {
|
if ($log = fopen(YSFGATEWAYLOGPATH."/".YSFGATEWAYLOGPREFIX."-".date("Y-m-d").".log", 'r')) {
|
||||||
while ($logLine = fgets($log)) {
|
while ($logLine = fgets($log)) {
|
||||||
// if (!strpos($logLine, "Debug") && !strpos($logLine,"Received a NAK") && !startsWith($logLine,"I:")) {
|
if (startsWith($logLine,"D:")) {
|
||||||
array_push($logLines, $logLine);
|
array_push($logLines, $logLine);
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
fclose($log);
|
fclose($log);
|
||||||
}
|
}
|
||||||
|
@ -438,6 +438,11 @@ function getActiveYSFReflectors($logLines) {
|
||||||
foreach ($logLines as $logLine) {
|
foreach ($logLines as $logLine) {
|
||||||
if (strpos($logLine, "Have reflector status reply from")) {
|
if (strpos($logLine, "Have reflector status reply from")) {
|
||||||
$timestamp = substr($logLine, 3, 19);
|
$timestamp = substr($logLine, 3, 19);
|
||||||
|
$timestamp2 = new DateTime($timestamp);
|
||||||
|
$now = new DateTime();
|
||||||
|
$timestamp2->add(new DateInterval('PT2H'));
|
||||||
|
|
||||||
|
if ($now->format('U') <= $timestamp2->format('U')) {
|
||||||
$str = substr($logLine, 60);
|
$str = substr($logLine, 60);
|
||||||
$id = strtok($str, "/");
|
$id = strtok($str, "/");
|
||||||
$name = strtok("/");
|
$name = strtok("/");
|
||||||
|
@ -449,6 +454,7 @@ function getActiveYSFReflectors($logLines) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
array_multisort($reflectorlist);
|
array_multisort($reflectorlist);
|
||||||
return $reflectorlist;
|
return $reflectorlist;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<!-- Standard-Panel-Inhalt -->
|
<!-- Standard-Panel-Inhalt -->
|
||||||
<div class="panel-heading">Reflectors-Info</div>
|
<div class="panel-heading">YSFReflectors reported active last 2 hours</div>
|
||||||
<!-- Tabelle -->
|
<!-- Tabelle -->
|
||||||
<table class="table">
|
<table class="table">
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@
|
||||||
if (count($activeYSFReflectors) > 0) {
|
if (count($activeYSFReflectors) > 0) {
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
|
<th>No.</th>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th>Description</th>
|
<th>Description</th>
|
||||||
<th>ID</th>
|
<th>ID</th>
|
||||||
|
@ -37,12 +38,15 @@
|
||||||
<th>Last info of</th>
|
<th>Last info of</th>
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
|
$counter = 1;
|
||||||
foreach ($activeYSFReflectors as $reflector) {
|
foreach ($activeYSFReflectors as $reflector) {
|
||||||
echo "<tr>";
|
echo "<tr>";
|
||||||
|
echo "<td>$counter</td>";
|
||||||
for ($i = 0; $i < 5; $i++) {
|
for ($i = 0; $i < 5; $i++) {
|
||||||
echo"<td>$reflector[$i]</td>";
|
echo"<td>$reflector[$i]</td>";
|
||||||
}
|
}
|
||||||
echo "</tr>";
|
echo "</tr>";
|
||||||
|
$counter++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in a new issue