From 30b4fda252ede7cdaa4b6b997438ed11e26ff2aa Mon Sep 17 00:00:00 2001 From: Gemorroj Date: Mon, 18 Mar 2013 13:15:44 +0300 Subject: [PATCH 1/2] bug #3840 When exporting to gzip format, the data is compressed 2 times --- ChangeLog | 1 + export.php | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/ChangeLog b/ChangeLog index 242686236e..e65c28febc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -97,6 +97,7 @@ underscore - bug #3829 Enabling query profiling crashes javascript based navigation + rfe #879 Reserved word warning + Remove the database ordering sub-feature of the only_db directive +bug #3840 When exporting to gzip format, the data is compressed 2 times 3.5.8.0 (not yet released) - bug #3828 MariaDB reported as MySQL diff --git a/export.php b/export.php index 88fab5f7ad..76a6635bf2 100644 --- a/export.php +++ b/export.php @@ -137,6 +137,20 @@ $dump_buffer_len = 0; // We send fake headers to avoid browser timeout when buffering $time_start = time(); + +/** + * Disable all handlers + * + * @return bool + */ +function PMA_handlersDisable() +{ + while (ob_get_level() > 0) { + ob_end_clean(); + } + return true; +} + /** * Detect whether gzencode is needed; it might not be needed if * the server is already compressing by itself @@ -158,6 +172,7 @@ function PMA_gzencodeNeeded() return false; } } + /** * Output handler for all exports, if needed buffering, it stores data into * $dump_buffer, otherwise it prints thems out. @@ -823,6 +838,7 @@ if (! empty($asfile)) { } exit(); } else { + PMA_handlersDisable(); PMA_Response::getInstance()->disable(); echo $dump_buffer; } From d8e5087f5d94c70e7619d8be51a83457e570c357 Mon Sep 17 00:00:00 2001 From: Gemorroj Date: Mon, 18 Mar 2013 13:49:16 +0300 Subject: [PATCH 2/2] correct previous commit (bug 3840) --- export.php | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/export.php b/export.php index 76a6635bf2..3db4231799 100644 --- a/export.php +++ b/export.php @@ -139,16 +139,13 @@ $time_start = time(); /** - * Disable all handlers + * Detect ob_gzhandler * * @return bool */ -function PMA_handlersDisable() +function PMA_isGzhandlerEnabled() { - while (ob_get_level() > 0) { - ob_end_clean(); - } - return true; + return in_array('ob_gzhandler', ob_list_handlers()); } /** @@ -166,7 +163,8 @@ function PMA_gzencodeNeeded() // and therefore, will gzip encode the content && ! (function_exists('apache_get_modules') && in_array('mod_deflate', apache_get_modules())) - ) { + && ! PMA_isGzhandlerEnabled() + ) { return true; } else { return false; @@ -838,7 +836,6 @@ if (! empty($asfile)) { } exit(); } else { - PMA_handlersDisable(); PMA_Response::getInstance()->disable(); echo $dump_buffer; }