瀏覽代碼

Summary (required)

Yeung Alan 5 年之前
父節點
當前提交
af0e385424
共有 2 個文件被更改,包括 9 次插入8 次删除
  1. 8 4
      DiskInfo/index.php
  2. 1 4
      DiskInfo/opr.php

+ 8 - 4
DiskInfo/index.php

@@ -206,7 +206,7 @@ $.get( "opr.php?opr=scan", function( data ) {
 	$(arr["devices"]).each(function(index, element) {
 		$.get( "opr.php?opr=info&drive=" + element["info_name"], function( data ) {
 			if(data.length > 0){
-				smartstat[element["info_name"]] = "Good";
+				smartstat[element["info_name"]] = "Unknown";
 				var table = JSON.parse(data);
 				if(table["ata_smart_attributes"]["table"].length > 0){		
 					$(table["ata_smart_attributes"]["table"]).each(function(tindex, telement) {
@@ -216,6 +216,9 @@ $.get( "opr.php?opr=scan", function( data ) {
 							}
 						}
 					});
+					if(smartstat[active] == "Unknown"){
+						smartstat[active] = "Good";
+					}
 				}else{
 					smartstat[element["info_name"]] = "Unknown";
 				}
@@ -307,9 +310,10 @@ $.get( "opr.php?opr=info&drive=" + active, function( data ) {
 			$("#health_prec").html(element["value"] + "%");
 		}
 	});
-	
-	if(smartstat[active] == "Unknown"){
-		smartstat[active] = "Good";
+	if(arr["ata_smart_attributes"]["table"].length > 0){
+		if(smartstat[active] == "Unknown"){
+			smartstat[active] = "Good";
+		}
 	}
 	
 	if(smartstat[active] == "Warning"){

+ 1 - 4
DiskInfo/opr.php

@@ -1,10 +1,7 @@
 <?php
 header("Access-Control-Allow-Origin: *");
-// WARNING the smartctl binary seem is corrupted
+// for linux user, you might need  chmod 0777 smartctl_x86_64 &&  chmod 0777 smartctl_armv6
 // you need smartctl 7.0.0 above to support JSON output
-// or you can choose to install by apt
-// in here are hard coded to static code for ease for debug
-// you should uncomment before use it
 
 $ok = false;
 preg_match('/smartmontools release ([0-9])\.([0-9])/', shell_exec(' sudo smartctl --version | grep "release"'), $filter);