mirror of
https://github.com/nextcloud/server.git
synced 2026-04-27 01:00:20 -04:00
Merge pull request #37959 from nextcloud/ob-proc
This commit is contained in:
commit
c2658bf913
1 changed files with 8 additions and 2 deletions
|
|
@ -257,9 +257,15 @@ class Generator {
|
|||
*/
|
||||
public static function getHardwareConcurrency(): int {
|
||||
static $width;
|
||||
|
||||
if (!isset($width)) {
|
||||
if (is_file("/proc/cpuinfo")) {
|
||||
$width = substr_count(file_get_contents("/proc/cpuinfo"), "processor");
|
||||
if (function_exists('ini_get')) {
|
||||
$openBasedir = ini_get('open_basedir');
|
||||
if (empty($openBasedir) || strpos($openBasedir, '/proc/cpuinfo') !== false) {
|
||||
$width = is_readable('/proc/cpuinfo') ? substr_count(file_get_contents('/proc/cpuinfo'), 'processor') : 0;
|
||||
} else {
|
||||
$width = 0;
|
||||
}
|
||||
} else {
|
||||
$width = 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue