Skip to content

Commit

Permalink
Merge pull request #33644 from nextcloud/backport/32216/stable24
Browse files Browse the repository at this point in the history
[stable24] Respect user settings in php.ini if they are big enough
  • Loading branch information
blizzz authored Aug 23, 2022
2 parents 1a92992 + 47fd27b commit fcff68a
Showing 1 changed file with 13 additions and 6 deletions.
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) {
@ini_set('max_execution_time', strval(3600));
}

if (intval(@ini_get('max_input_time') ?? 0) < 3600) {
@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(max(intval(@ini_get('max_execution_time')), intval(@ini_get('max_input_time'))));
}
@ini_set('max_execution_time', '3600');
@ini_set('max_input_time', '3600');

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

0 comments on commit fcff68a

Please sign in to comment.