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

Respect user settings in php.ini if they are big enough #32216

Merged
merged 3 commits into from
May 17, 2022
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions lib/base.php
Original file line number Diff line number Diff line change
Expand Up @@ -623,16 +623,23 @@ public static function init() {
throw new \RuntimeException('Could not set timezone to UTC');
}


//try to configure php to enable big file uploads.
//this doesn´t work always depending on the web server and php configuration.
//Let´s try to overwrite some defaults anyway
//this doesn´t work always depending on the webserver and php configuration.
//Let´s try to overwrite some defaults if they are smaller than 1 hour

if (intval(@ini_get('max_execution_time')?? 0) < 3600) {
mickenordin marked this conversation as resolved.
Show resolved Hide resolved
@ini_set('max_execution_time', strval(3600));
}

if (intval(@ini_get('max_input_time')?? 0) < 3600) {
mickenordin marked this conversation as resolved.
Show resolved Hide resolved
@ini_set('max_input_time', strval(3600));
}

//try to set the maximum execution time to 60min
//try to set the maximum execution time to the largest time limit we have
if (strpos(@ini_get('disable_functions'), 'set_time_limit') === false) {
@set_time_limit(3600);
@set_time_limit(strval(max(intval(@ini_get('max_execution_time')),intval(@ini_get('max_input_time')))));
mickenordin marked this conversation as resolved.
Show resolved Hide resolved
}
@ini_set('max_execution_time', '3600');
@ini_set('max_input_time', '3600');

self::setRequiredIniValues();
self::handleAuthHeaders();
Expand Down