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() { function getFirmwareVersion() {
$logPath = MMDVMLOGPATH."/".MMDVMLOGPREFIX."-".date("Y-m-d").".log"; $logPath = MMDVMLOGPATH."/".MMDVMLOGPREFIX."-".date("Y-m-d").".log";
$logLines = explode("\n", `grep "MMDVM protocol version" $logPath`); $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); $firmware = "n/a";
if (strlen($firmware) > 0) { 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'); $fp = fopen('/tmp/MMDVMFirmware.txt', 'w');
fwrite($fp, $firmware); fwrite($fp, $firmware);
fclose($fp); fclose($fp);