diff --git a/_include.php b/_include.php index 869d1c166..6e020e660 100644 --- a/_include.php +++ b/_include.php @@ -4,9 +4,12 @@ //header('Strict-Transport-Security: max-age=31536000'); -// Uncomment to use gzip encoded output +// Uncomment to use gzip compressed output //define('USE_GZIP', 1); +// Uncomment to use brotli compressed output +//define('USE_BROTLI', 1); + // Uncomment to enable multiple domain installation. //define('MULTIDOMAIN', 1); diff --git a/snappymail/v/0.0.0/include.php b/snappymail/v/0.0.0/include.php index 6671be999..19ec2164d 100644 --- a/snappymail/v/0.0.0/include.php +++ b/snappymail/v/0.0.0/include.php @@ -84,7 +84,7 @@ if (!is_dir(APP_DATA_FOLDER_PATH)) { - mkdir(APP_DATA_FOLDER_PATH, 0700); + mkdir(APP_DATA_FOLDER_PATH, 0700, true); } else { @@ -239,9 +239,7 @@ // See https://github.com/kjdev/php-ext-brotli if (!ini_get('zlib.output_compression') && !ini_get('brotli.output_compression')) { - if (defined('USE_GZIP')) { - ob_start('ob_gzhandler'); - } else if (defined('USE_BROTLI') && is_callable('brotli_compress_add') && false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'br')) { + if (defined('USE_BROTLI') && is_callable('brotli_compress_add') && false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'br')) { ob_start(function(string $buffer, int $phase){ static $resource; if ($phase & PHP_OUTPUT_HANDLER_START) { @@ -250,6 +248,8 @@ } return brotli_compress_add($resource, $buffer, ($phase & PHP_OUTPUT_HANDLER_FINAL) ? BROTLI_FINISH : BROTLI_PROCESS); }); + } else if (defined('USE_GZIP')) { + ob_start('ob_gzhandler'); } }