1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-15 11:04:02 +02:00

Remove bzip2 compression support

It didn't work for exports bigger than 1 MB.
An alternative would be to remove the limit from output buffer which would need memory for the whole export.
Another alternative would be to create a temporary file in output handler and bzwrite() to this file - that would work but it's complicated, especially if we want to output the file progressively - bzopen($tmp, 'w'), fopen($tmp, 'r').
This commit is contained in:
Jakub Vrana
2013-04-29 14:00:35 -07:00
parent 7f05141b89
commit 1ecdde0500
5 changed files with 11 additions and 23 deletions

View File

@@ -570,9 +570,6 @@ username.form['auth[driver]'].onchange();
if (function_exists('gzencode')) {
$return['gz'] = 'gzip';
}
if (function_exists('bzcompress')) {
$return['bz2'] = 'bzip2';
}
return $return;
}
@@ -704,14 +701,10 @@ username.form['auth[driver]'].onchange();
$output = $_POST["output"];
$ext = (ereg('sql', $_POST["format"]) ? "sql" : ($multi_table ? "tar" : "csv")); // multiple CSV packed to TAR
header("Content-Type: " .
($output == "bz2" ? "application/x-bzip" :
($output == "gz" ? "application/x-gzip" :
($ext == "tar" ? "application/x-tar" :
($ext == "sql" || $output != "file" ? "text/plain" : "text/csv") . "; charset=utf-8"
))));
if ($output == "bz2") {
ob_start('bzcompress', 1e6);
}
)));
if ($output == "gz") {
ob_start('gzencode', 1e6);
}

View File

@@ -602,10 +602,10 @@ function get_file($key, $decompress = false) {
}
$name = $file["name"][$key];
$tmp_name = $file["tmp_name"][$key];
$content = file_get_contents($decompress && ereg('\\.gz$', $name) ? "compress.zlib://$tmp_name"
: ($decompress && ereg('\\.bz2$', $name) ? "compress.bzip2://$tmp_name"
$content = file_get_contents($decompress && ereg('\\.gz$', $name)
? "compress.zlib://$tmp_name"
: $tmp_name
)); //! may not be reachable because of open_basedir
); //! may not be reachable because of open_basedir
if ($decompress) {
$start = substr($content, 0, 3);
if (function_exists("iconv") && ereg("^\xFE\xFF|^\xFF\xFE", $start, $regs)) { // not ternary operator to save memory