Skip to content

Commit 5e2e63a

Browse files
authored
fix panel details (number of cpu core for Windows) (#340)
fix panel details (number of cpu core for Windows)
1 parent 5e60267 commit 5e2e63a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

panellib/analyze.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -2000,10 +2000,10 @@ function analyse_tree_host_graph_detail() {
20002000

20012001
$cpu_cores = 0;
20022002
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
2003-
$output = shell_exec('wmic cpu get NumberOfCores');
2003+
$output = shell_exec("powershell -Command \"Get-WmiObject Win32_Processor | Select-Object NumberOfLogicalProcessors\"");
20042004
if (!is_null($output) && $output !== false) {
2005-
$lines = preg_split('/\r\n|\r|\n/', $output);
2006-
$cpu_cores = $lines[1];
2005+
preg_match_all('/\d+/', $output, $matches);
2006+
$cpu_cores = array_sum($matches[0]);
20072007
}
20082008
} elseif (substr_count(strtolower(PHP_OS), 'darwin')) {
20092009
$cpu_cores = shell_exec('sysctl -n hw.ncpu');

0 commit comments

Comments
 (0)