diff --git a/api/src/Vfs.php b/api/src/Vfs.php index a2359cb400..deda97ed11 100644 --- a/api/src/Vfs.php +++ b/api/src/Vfs.php @@ -1504,6 +1504,11 @@ class Vfs extends Vfs\Base //error_log("Total files: " . $total_files . " Peak memory to zip: " . self::hsize(memory_get_peak_usage(true))); + // FIRST: switch off zlib.output_compression, as this would limit downloads in size to memory_limit + ini_set('zlib.output_compression',0); + // SECOND: end all active output buffering + while(ob_end_clean()) {} + // Stream the file to the client header("Content-Type: application/zip"); header("Content-Length: " . filesize($zip_file)); diff --git a/importexport/inc/class.importexport_export_ui.inc.php b/importexport/inc/class.importexport_export_ui.inc.php index 61192d66af..aa99a70f8b 100644 --- a/importexport/inc/class.importexport_export_ui.inc.php +++ b/importexport/inc/class.importexport_export_ui.inc.php @@ -446,6 +446,11 @@ class importexport_export_ui { $appname = $_GET['_appname']; $nicefname = $_GET['filename'] ? $_GET['filename'] : 'egw_export_'.$appname.'-'.date('Y-m-d'); + // FIRST: switch off zlib.output_compression, as this would limit downloads in size to memory_limit + ini_set('zlib.output_compression',0); + // SECOND: end all active output buffering + while(ob_end_clean()) {} + // Get charset $charset = Api\Cache::getSession('importexport', $tmpfname); diff --git a/setup/db_backup.php b/setup/db_backup.php index c98f29b90b..f6eca27aef 100644 --- a/setup/db_backup.php +++ b/setup/db_backup.php @@ -42,8 +42,12 @@ if (!empty($_POST['download'])) { $file = key($_POST['download']); $file = $db_backup->backup_dir.'/'.basename($file); // basename to now allow to change the dir - while (@ob_end_clean()) {} // end all active output buffering - ini_set('zlib.output_compression',0); // switch off zlib.output_compression, as this would limit downloads in size to memory_limit + + // FIRST: switch off zlib.output_compression, as this would limit downloads in size to memory_limit + ini_set('zlib.output_compression',0); + // SECOND: end all active output buffering + while(ob_end_clean()) {} + Api\Header\Content::type(basename($file)); readfile($file); exit; @@ -310,4 +314,4 @@ if ($run_in_egw) else { $GLOBALS['egw_setup']->html->show_footer(); -} +} \ No newline at end of file