From e10e47044e0034b8224f65598739b2c3d6e0ddbd Mon Sep 17 00:00:00 2001 From: David M Date: Fri, 16 Feb 2007 04:20:45 +0000 Subject: #8154 git-svn-id: file:///svn/phpbb/trunk@6991 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/acp_database.php | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php index e1ec9fa8bc..1424bdb84d 100644 --- a/phpBB/includes/acp/acp_database.php +++ b/phpBB/includes/acp/acp_database.php @@ -498,12 +498,15 @@ class base_extractor var $store; var $download; var $time; + var $format; function base_extractor($download = false, $store = false, $format, $filename, $time) { $this->download = $download; $this->store = $store; $this->time = $time; + $this->format = $format; + switch ($format) { case 'text': @@ -531,8 +534,6 @@ class base_extractor if ($download == true) { - $this->fh = fopen('php://output', 'wb'); - $name = $filename . $ext; header('Pragma: no-cache'); header("Content-Type: $mimetype; name=\"$name\""); @@ -541,8 +542,9 @@ class base_extractor switch ($format) { case 'bzip2': - ob_start('ob_bz2handler'); + ob_start(); break; + case 'gzip': ob_start('ob_gzhandler'); break; @@ -575,9 +577,11 @@ class base_extractor $close($this->fp); } - if ($this->download) + // bzip2 must be written all the way at the end + if ($this->format === 'bzip2') { - fclose($this->fh); + $c = ob_get_clean(); + echo bzcompress($c); } } @@ -595,7 +599,13 @@ class base_extractor if ($this->download === true) { - fwrite($this->fh, $data); + echo $data; + + // we can write the gzip data as soon as we get it + if ($this->format === 'gzip') + { + ob_flush(); + } } } } @@ -2156,17 +2166,6 @@ function sanitize_data_generic($text) return implode('||', $val); } -// Internal handler for BZip2 -function ob_bz2handler($data, $mode) -{ - static $internal = ''; - $internal .= $data; - if ($mode & PHP_OUTPUT_HANDLER_END) - { - return bzcompress($internal); - } -} - // modified from PHP.net function fgetd(&$fp, $delim, $read, $seek, $eof, $buffer = 8192) { -- cgit v1.2.1