Commit c47f9f96 authored by Adrian Rossouw's avatar Adrian Rossouw

Added a conditional check around the reading for /proc/cpuinfo, which was causing a

warning on OSX and possibly *bsd.
parent a5816b8a
......@@ -295,11 +295,13 @@ function _provision_default_web_group() {
*/
function provision_count_cpus() {
$ncpus = FALSE;
# this should work on Linux with a /proc filesystem
$cpuinfo = file_get_contents("/proc/cpuinfo");
if ($cpuinfo !== FALSE) {
if (preg_match_all("/^processor.*:.*[0-9]+$/m", $cpuinfo, $matches)) {
$ncpus = count(array_pop($matches));
if (file_exists("/proc/cpuinfo")) {
# this should work on Linux with a /proc filesystem
$cpuinfo = file_get_contents("/proc/cpuinfo");
if ($cpuinfo !== FALSE) {
if (preg_match_all("/^processor.*:.*[0-9]+$/m", $cpuinfo, $matches)) {
$ncpus = count(array_pop($matches));
}
}
}
return $ncpus;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment