diff --git a/device.php b/device.php index 3c7180d..3d94180 100644 --- a/device.php +++ b/device.php @@ -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; } } -?> \ No newline at end of file +?> diff --git a/index.php b/index.php index d587d3b..c4b7466 100644 --- a/index.php +++ b/index.php @@ -214,7 +214,7 @@ require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'device.php');