Fix missing firmware info error

This commit is contained in:
phl0 2017-01-10 21:04:23 +01:00
parent d21620d441
commit 78e39950f5
No known key found for this signature in database
GPG key ID: 48EA1E640798CA9A

View file

@ -25,8 +25,11 @@ function getMMDVMHostFileVersion() {
function getFirmwareVersion() {
$logPath = MMDVMLOGPATH."/".MMDVMLOGPREFIX."-".date("Y-m-d").".log";
$logLines = explode("\n", `grep "MMDVM protocol version" $logPath`);
$firmware = substr($logLines[count($logLines)-2], strpos($logLines[count($logLines)-2], "description")+13, strlen($logLines[count($logLines)-2])-strpos($logLines[count($logLines)-2], "description")+13);
if (strlen($firmware) > 0) {
$firmware = "n/a";
if (count($logLines) >= 2) {
$firmware = substr($logLines[count($logLines)-2], strpos($logLines[count($logLines)-2], "description")+13, strlen($logLines[count($logLines)-2])-strpos($logLines[count($logLines)-2], "description")+13);
}
if ($firmware != "n/a") {
$fp = fopen('/tmp/MMDVMFirmware.txt', 'w');
fwrite($fp, $firmware);
fclose($fp);