pull/32/merge
哇呜哇呜呀咦耶 2023-09-21 14:42:04 +08:00 committed by GitHub
commit ad50a2091b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 4 deletions

View File

@ -33,7 +33,7 @@ if (($str = @file("/proc/cpuinfo")) !== false){
@preg_match_all("/BogoMIPS\s{0,}\:+\s{0,}([\d\.]+)[\r\n]+/", $str, $bogomips);
@preg_match_all("/Model\s{0,}\:+\s{0,}([\w\s\)\(\@.-]+)([\r\n]+)/s", $str, $pimodel);
if (false !== is_array($model[1])){
if (is_array($model[1]) && !empty($model[1])){
$D['cpu']['count'] = sizeof($model[1]);
$bogomips[1][0] = ' | Bogomips:'.$bogomips[1][0];
if($D['cpu']['count'] == 1){
@ -42,6 +42,20 @@ if (($str = @file("/proc/cpuinfo")) !== false){
else{
$D['cpu']['model'] = $model[1][0].$bogomips[1][0].' ×'.$D['cpu']['count'];
}
} else {
$str = shell_exec("lscpu");
@preg_match_all("/Model\s+name\s{0,}\:+\s{0,}([\w\s\)\(\@.-]+)([\r\n]+)/s", $str, $model);
@preg_match_all("/CPU\(s\)\s{0,}\:+\s{0,}(\d+)([\r\n]+)/s", $str, $cpucnt);
if (false !== is_array($model[1])) {
$D['cpu']['count'] = $cpucnt[1][0];
$bogomips[1][0] = ' | Bogomips:'.$bogomips[1][0];
if($D['cpu']['count'] == 1){
$D['cpu']['model'] = $model[1][0].$bogomips[1][0];
}
else{
$D['cpu']['model'] = $model[1][0].$bogomips[1][0].' ×'.$D['cpu']['count'];
}
}
}
if (false !== is_array($pimodel[1])){
@ -180,4 +194,4 @@ function get_info(){
$D['net']['count'] = 0;
}
}
?>
?>

View File

@ -214,7 +214,7 @@ require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'device.php');
</div>
<div class="col-md-2 col-sm-2 col-xs-2" style="padding: 0;">
<div style="height: 80px; margin-top: 10px;">
<div class="text-center" style="padding: 2px 0 2px 0; background-color: #CCCCCC;"><strong><span id="net-interface-<?php echo($i+1) ?>-name"><?php echo($D['net']['interfaces'][$i]['name']) ?></span></strong></div>
<div class="text-center" style="padding: 2px 0 2px 0; background-color: #CCCCCC; word-wrap: break-word;"><strong><span id="net-interface-<?php echo($i+1) ?>-name"><?php echo($D['net']['interfaces'][$i]['name']) ?></span></strong></div>
<div class="text-center" style="padding: 10px 0 10px 0; background-color: #9BCEFD;"><span id="net-interface-<?php echo($i+1) ?>-total-in"><?php echo($D['net']['interfaces'][$i]['total_in']) ?></span><br /><small class="label">IN</small></div>
<div class="text-center" style="padding: 10px 0 10px 0; background-color: #CDFD9F;"><span id="net-interface-<?php echo($i+1) ?>-total-out"><?php echo($D['net']['interfaces'][$i]['total_out']) ?></span><br /><small class="label">OUT</small></div>
</div>
@ -245,4 +245,4 @@ require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'device.php');
</div>
<script src="assets/dashboard.min.js"></script>
</body>
</html>
</html>