Add last parity log to Dashboard (align with Main page)

This commit is contained in:
bergware
2017-10-30 14:27:19 +01:00
parent 91e7734e9f
commit 8d1a0d34eb
3 changed files with 19 additions and 12 deletions
+7
View File
@@ -176,6 +176,13 @@ function read_parity_log($epoch, $busy=false) {
}
return $line ?: $last ?: '0|0|0|0|0';
}
function last_parity_log() {
$log = '/boot/config/parity-checks.log';
if (!file_exists($log)) return [0,0,0,0,0];
list($date,$duration,$speed,$status,$error) = explode('|',exec("tail -1 $log"));
list($y,$m,$d,$t) = preg_split('/ +/',$date);
return [strtotime("$d-$m-$y $t"), $duration, $speed, $status, $error];
}
function urlencode_path($path) {
return str_replace("%2F", "/", urlencode($path));
}