diff options
author | Simon L <szaimen@e.mail.de> | 2023-11-15 16:47:59 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-15 16:47:59 +0100 |
commit | c2658bf913e2fb6f075428710ebb788dbe84bb11 (patch) | |
tree | 142f4110f072a39faf477ab848abb9d28e756445 /lib | |
parent | 8ec90e16b3eda7029d5674dc8c83c223ce7b7757 (diff) | |
parent | ef5f7d0a907a2864d39272f1b82b608fc0ef45fb (diff) | |
download | nextcloud-server-c2658bf913e2fb6f075428710ebb788dbe84bb11.tar.gz nextcloud-server-c2658bf913e2fb6f075428710ebb788dbe84bb11.zip |
Merge pull request #37959 from nextcloud/ob-proc
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Preview/Generator.php | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/private/Preview/Generator.php b/lib/private/Preview/Generator.php index 958f58e2a01..695d4a3357f 100644 --- a/lib/private/Preview/Generator.php +++ b/lib/private/Preview/Generator.php @@ -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; } |