Skip to content

Commit 0cf5add

Browse files
authored
Us strpos() only
Signed-off-by: Git'Fellow <[email protected]>
1 parent d84f0b3 commit 0cf5add

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

lib/private/Preview/Generator.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -295,20 +295,14 @@ public static function unguardWithSemaphore($semId): bool {
295295
*/
296296
public static function getHardwareConcurrency(): int {
297297
static $width;
298+
298299
if (!isset($width)) {
299300
if (function_exists('ini_get')) {
300301
$openBasedir = ini_get('open_basedir');
301-
if ($openBasedir == '') {
302+
if (empty($openBasedir) || strpos($openBasedir, '/proc/cpuinfo') !== false) {
302303
$width = is_readable('/proc/cpuinfo') ? substr_count(file_get_contents('/proc/cpuinfo'), 'processor') : 0;
303304
} else {
304-
$openBasedirPaths = explode(':', $openBasedir);
305-
foreach ($openBasedirPaths as $path) {
306-
if (strpos($path, '/proc') === 0 || $path === '/proc/cpuinfo') {
307-
$width = is_readable('/proc/cpuinfo') ? substr_count(file_get_contents('/proc/cpuinfo'), 'processor') : 0;
308-
} else {
309-
$width = 0;
310-
}
311-
}
305+
$width = 0;
312306
}
313307
} else {
314308
$width = 0;

0 commit comments

Comments
 (0)