mirror of
https://github.com/nextcloud/server.git
synced 2026-04-15 22:11:17 -04:00
Us strpos() only
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
This commit is contained in:
parent
4b97e1614b
commit
febc24db13
1 changed files with 3 additions and 9 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue