Skip to content

Commit ef5f7d0

Browse files
committed
Us strpos() only
Signed-off-by: Git'Fellow <[email protected]>
1 parent 53b8473 commit ef5f7d0

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
@@ -257,20 +257,14 @@ public static function unguardWithSemaphore(false|\SysvSemaphore $semId): bool {
257257
*/
258258
public static function getHardwareConcurrency(): int {
259259
static $width;
260+
260261
if (!isset($width)) {
261262
if (function_exists('ini_get')) {
262263
$openBasedir = ini_get('open_basedir');
263-
if ($openBasedir == '') {
264+
if (empty($openBasedir) || strpos($openBasedir, '/proc/cpuinfo') !== false) {
264265
$width = is_readable('/proc/cpuinfo') ? substr_count(file_get_contents('/proc/cpuinfo'), 'processor') : 0;
265266
} else {
266-
$openBasedirPaths = explode(':', $openBasedir);
267-
foreach ($openBasedirPaths as $path) {
268-
if (strpos($path, '/proc') === 0 || $path === '/proc/cpuinfo') {
269-
$width = is_readable('/proc/cpuinfo') ? substr_count(file_get_contents('/proc/cpuinfo'), 'processor') : 0;
270-
} else {
271-
$width = 0;
272-
}
273-
}
267+
$width = 0;
274268
}
275269
} else {
276270
$width = 0;

0 commit comments

Comments
 (0)