summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGit'Fellow <12234510+solracsf@users.noreply.github.com>2023-04-27 19:26:59 +0200
committerbackportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com>2023-11-16 12:59:56 +0000
commitfebc24db137f585de2b6871ac64e474b07142f65 (patch)
tree10cfb48ae40a33594cfa783e6958b0556f946fb3
parent4b97e1614bf3574e0252795da7d87e0759948cc9 (diff)
downloadnextcloud-server-febc24db137f585de2b6871ac64e474b07142f65.tar.gz
nextcloud-server-febc24db137f585de2b6871ac64e474b07142f65.zip
Us strpos() only
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
-rw-r--r--lib/private/Preview/Generator.php12
1 files changed, 3 insertions, 9 deletions
diff --git a/lib/private/Preview/Generator.php b/lib/private/Preview/Generator.php
index e88c307517d..f1a43ee9128 100644
--- a/lib/private/Preview/Generator.php
+++ b/lib/private/Preview/Generator.php
@@ -263,20 +263,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;