Utils: fixed crash in getCoreCount(), closes #2600

this should just default to 2 instead of shitting its pants.
This commit is contained in:
Dylan K. Taylor 2018-12-22 13:27:11 +00:00
parent 75df6973df
commit 1455c38dbe

View File

@ -313,8 +313,8 @@ class Utils{
++$processors; ++$processors;
} }
} }
}else{ }elseif(is_readable("/sys/devices/system/cpu/present")){
if(preg_match("/^([0-9]+)\\-([0-9]+)$/", trim(@file_get_contents("/sys/devices/system/cpu/present")), $matches) > 0){ if(preg_match("/^([0-9]+)\\-([0-9]+)$/", trim(file_get_contents("/sys/devices/system/cpu/present")), $matches) > 0){
$processors = (int) ($matches[2] - $matches[1]); $processors = (int) ($matches[2] - $matches[1]);
} }
} }