Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rely on getconf() instead of /proc/cpuinfo #37923

Closed
wants to merge 2 commits into from
Closed

Rely on getconf() instead of /proc/cpuinfo #37923

wants to merge 2 commits into from

Conversation

solracsf
Copy link
Member

@solracsf solracsf commented Apr 25, 2023

Summary

getconf() is more compatible and less open_basedir() error prone.

Checklist

Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
@solracsf solracsf added the 3. to review Waiting for reviews label Apr 25, 2023
@solracsf solracsf added this to the Nextcloud 27 milestone Apr 25, 2023
lib/private/Preview/Generator.php Fixed Show fixed Hide fixed
lib/private/Preview/Generator.php Fixed Show fixed Hide fixed
lib/private/Preview/Generator.php Fixed Show fixed Hide fixed
lib/private/Preview/Generator.php Fixed Show fixed Hide fixed
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
if (is_file("/proc/cpuinfo")) {
$width = substr_count(file_get_contents("/proc/cpuinfo"), "processor");
if (function_exists('getconf')) {
$width = getconf('_NPROCESSORS_ONLN');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getconf is not available on my local php. Does it belong to an extension?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, you're right! I'm not using a standard PHP and, indeed, this module is not a common one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants