Merge pull request #196 from IZ7BOJ/patch-1

Update getActualLink in functions.php
This commit is contained in:
Kim - DG9VH 2020-03-18 20:49:37 +01:00 committed by GitHub
commit 25373a71d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -781,6 +781,26 @@ function getActualLink($logLines, $mode) {
return $to;
}
}
if ( ($to == "") && file_exists('/tmp/YSFState.txt')) { // reflector is in yesterday's log
$logPath2 = YSFGATEWAYLOGPATH."/".YSFGATEWAYLOGPREFIX."-".date('Y-m-d',strtotime(date('Y-m-d').' -1 day')).".log"; //open yesterday's log
$logLines2 = explode("\n", `egrep -h "Linked to" $logPath2`);
$to = "";
foreach($logLines2 as $logLine) {
if ($logLine!=='') {
$to = substr($logLine, 37, 16);
if ($to == "MMDVM" )
continue;
}
}
if ($to !== "") {
$fp = fopen('/tmp/YSFState.txt', 'w');
fwrite($fp, $to);
fclose($fp);
return $to;
}
}
} else {
return _("YSFGateway not running");
}