Code cleanup and reformatting

This commit is contained in:
dg9vh 2017-05-16 08:05:52 +00:00
parent f6a36ad9ce
commit 47f1cee519
8 changed files with 207 additions and 214 deletions

View file

@ -18,7 +18,6 @@
<tbody> <tbody>
<?php <?php
error_reporting(E_ERROR | E_WARNING | E_PARSE); error_reporting(E_ERROR | E_WARNING | E_PARSE);
//include "./functions.php";
try{ try{
$datas = array(); $datas = array();
if (!(exec('/bin/df -T | awk -v c=`/bin/df -T | grep -bo "Type" | awk -F: \'{print $2}\'` \'{print substr($0,c);}\' | tail -n +2 | awk \'{print $1","$2","$3","$4","$5","$6","$7}\'', $df))) { if (!(exec('/bin/df -T | awk -v c=`/bin/df -T | grep -bo "Type" | awk -F: \'{print $2}\'` \'{print substr($0,c);}\' | tail -n +2 | awk \'{print $1","$2","$3","$4","$5","$6","$7}\'', $df))) {

View file

@ -192,7 +192,6 @@ function showMode($mode, $mmdvmconfigs) {
function getMMDVMLog() { function getMMDVMLog() {
// Open Logfile and copy loglines into LogLines-Array() // Open Logfile and copy loglines into LogLines-Array()
$logPath = MMDVMLOGPATH."/".MMDVMLOGPREFIX."-".date("Y-m-d").".log"; $logPath = MMDVMLOGPATH."/".MMDVMLOGPREFIX."-".date("Y-m-d").".log";
//$logLines = explode("\n", `grep M: $logPath`);
$logLines = explode("\n", `egrep -h "from|end|watchdog|lost" $logPath`); $logLines = explode("\n", `egrep -h "from|end|watchdog|lost" $logPath`);
return $logLines; return $logLines;
} }
@ -201,14 +200,12 @@ function getShortMMDVMLog() {
// Open Logfile and copy loglines into LogLines-Array() // Open Logfile and copy loglines into LogLines-Array()
$logPath = MMDVMLOGPATH."/".MMDVMLOGPREFIX."-".date("Y-m-d").".log"; $logPath = MMDVMLOGPATH."/".MMDVMLOGPREFIX."-".date("Y-m-d").".log";
$logLines = explode("\n", `egrep -h "from|end|watchdog|lost|Alias|0000" $logPath | grep -v "data header" | tail -20`); $logLines = explode("\n", `egrep -h "from|end|watchdog|lost|Alias|0000" $logPath | grep -v "data header" | tail -20`);
return $logLines; return $logLines;
} }
function getYSFGatewayLog() { function getYSFGatewayLog() {
// Open Logfile and copy loglines into LogLines-Array() // Open Logfile and copy loglines into LogLines-Array()
$logPath = YSFGATEWAYLOGPATH."/".YSFGATEWAYLOGPREFIX."-".date("Y-m-d").".log"; $logPath = YSFGATEWAYLOGPATH."/".YSFGATEWAYLOGPREFIX."-".date("Y-m-d").".log";
//$logLines = explode("\n", `egrep -h "D:|M:" $logPath`);
$logLines = explode("\n", `egrep -h "repeater|Starting|Disconnect|Connect|Automatic|Disconnecting|Reverting" $logPath`); $logLines = explode("\n", `egrep -h "repeater|Starting|Disconnect|Connect|Automatic|Disconnecting|Reverting" $logPath`);
return $logLines; return $logLines;
} }
@ -503,7 +500,6 @@ function getLastHeard($logLines, $onlyLast) {
array_push($heardCalls, $listElem[2]."#".$listElem[1].$listElem[4]); array_push($heardCalls, $listElem[2]."#".$listElem[1].$listElem[4]);
if (defined("ENABLEXTDLOOKUP")) { if (defined("ENABLEXTDLOOKUP")) {
if ($listElem[2] !== "??????????") { if ($listElem[2] !== "??????????") {
//$listElem[3] = "Dummy"; //Should speed up this function - time-issue!
$listElem[3] = getName($call_canon); //Should speed up this function - time-issue! $listElem[3] = getName($call_canon); //Should speed up this function - time-issue!
} else { } else {
$listElem[3] = "---"; $listElem[3] = "---";
@ -534,7 +530,6 @@ function getActualMode($metaLastHeard, $mmdvmconfigs) {
// returns mode of repeater actual working in // returns mode of repeater actual working in
$listElem = $metaLastHeard[0]; $listElem = $metaLastHeard[0];
$timestamp = new DateTime($listElem[0],new DateTimeZone(TIMEZONE)); $timestamp = new DateTime($listElem[0],new DateTimeZone(TIMEZONE));
$mode = $listElem[1]; $mode = $listElem[1];
if (startsWith($mode, "DMR")) { if (startsWith($mode, "DMR")) {
$mode = "DMR"; $mode = "DMR";

View file

@ -16,7 +16,6 @@ if (defined("ENABLEYSFGATEWAY")) {
$logLinesYSFGateway = getYSFGatewayLog(); $logLinesYSFGateway = getYSFGatewayLog();
showLapTime("getYSFGatewayLog"); showLapTime("getYSFGatewayLog");
$reverseLogLinesYSFGateway = $logLinesYSFGateway; $reverseLogLinesYSFGateway = $logLinesYSFGateway;
//array_multisort($reverseLogLinesYSFGateway,SORT_DESC);
rsort($reverseLogLinesYSFGateway); rsort($reverseLogLinesYSFGateway);
showLapTime("array_multisort"); showLapTime("array_multisort");
$activeYSFReflectors = getActiveYSFReflectors(); $activeYSFReflectors = getActiveYSFReflectors();