aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorSimon L <szaimen@e.mail.de>2023-11-15 16:47:59 +0100
committerGitHub <noreply@github.com>2023-11-15 16:47:59 +0100
commitc2658bf913e2fb6f075428710ebb788dbe84bb11 (patch)
tree142f4110f072a39faf477ab848abb9d28e756445 /lib
parent8ec90e16b3eda7029d5674dc8c83c223ce7b7757 (diff)
parentef5f7d0a907a2864d39272f1b82b608fc0ef45fb (diff)
downloadnextcloud-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.php10
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;
}