Set upload_tmp_directory & upload_max_filesize INI parameters after log initialized

This commit is contained in:
Benjamin Renard 2023-03-02 10:53:22 +01:00
parent 7166e63032
commit 5ca3208c91
Signed by: bn8
GPG key ID: 3E2E1CE1907115BC

View file

@ -67,16 +67,6 @@ class App {
$sentry_transaction = new SentryTransaction();
$sentry_span = new SentrySpan('app.init', 'Application initialization');
// Define upload_tmp_dir
if (self::isset('upload_tmp_directory'))
Config :: ini_set('upload_tmp_dir', self::get('upload_tmp_directory', null, 'string'));
if (self::isset('upload_max_filesize')) {
Config :: ini_set('upload_max_filesize', self::get('upload_max_filesize', null, 'string'));
// post_max_size must be larger than upload_max_filesize
// See: https://www.php.net/manual/en/ini.core.php#ini.post-max-size
Config :: ini_set('post_max_size', strval(self::get('upload_max_filesize', null, 'int') * 1.1));
}
if (self :: get('log.enabled', null, 'bool'))
Log::init();
if (self :: get('session.enabled', null, 'bool'))
@ -97,6 +87,17 @@ class App {
I18n::init();
if (self :: get('cli.enabled', null, 'bool'))
Cli::init();
// Define common upload_tmp_dir & upload_max_filesize PHP ini
if (self::isset('upload_tmp_directory'))
Config :: ini_set('upload_tmp_dir', self::get('upload_tmp_directory', null, 'string'));
if (self::isset('upload_max_filesize')) {
Config :: ini_set('upload_max_filesize', self::get('upload_max_filesize', null, 'string'));
// post_max_size must be larger than upload_max_filesize
// See: https://www.php.net/manual/en/ini.core.php#ini.post-max-size
Config :: ini_set('post_max_size', strval(self::get('upload_max_filesize', null, 'int') * 1.1));
}
$sentry_span->finish();
}