diff options
author | Git'Fellow <12234510+solracsf@users.noreply.github.com> | 2023-04-27 19:26:59 +0200 |
---|---|---|
committer | Git'Fellow <12234510+solracsf@users.noreply.github.com> | 2023-11-15 00:04:25 +0100 |
commit | ef5f7d0a907a2864d39272f1b82b608fc0ef45fb (patch) | |
tree | 3ee392e4c65cb47e19fb7b1baf142127164f0b52 /lib | |
parent | 53b84732a3fcd793aae2c207fafefe992b2b966a (diff) | |
download | nextcloud-server-ef5f7d0a907a2864d39272f1b82b608fc0ef45fb.tar.gz nextcloud-server-ef5f7d0a907a2864d39272f1b82b608fc0ef45fb.zip |
Us strpos() only
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Preview/Generator.php | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/lib/private/Preview/Generator.php b/lib/private/Preview/Generator.php index c0c94a84bdb..695d4a3357f 100644 --- a/lib/private/Preview/Generator.php +++ b/lib/private/Preview/Generator.php @@ -257,20 +257,14 @@ class Generator { */ public static function getHardwareConcurrency(): int { static $width; + if (!isset($width)) { if (function_exists('ini_get')) { $openBasedir = ini_get('open_basedir'); - if ($openBasedir == '') { + if (empty($openBasedir) || strpos($openBasedir, '/proc/cpuinfo') !== false) { $width = is_readable('/proc/cpuinfo') ? substr_count(file_get_contents('/proc/cpuinfo'), 'processor') : 0; } else { - $openBasedirPaths = explode(':', $openBasedir); - foreach ($openBasedirPaths as $path) { - if (strpos($path, '/proc') === 0 || $path === '/proc/cpuinfo') { - $width = is_readable('/proc/cpuinfo') ? substr_count(file_get_contents('/proc/cpuinfo'), 'processor') : 0; - } else { - $width = 0; - } - } + $width = 0; } } else { $width = 0; |