1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-12 01:24:17 +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

@@ -20,10 +20,10 @@ if (!$error && $_POST) {
$fp = false;
$query = $_POST["query"];
if ($_POST["webfile"]) {
$fp = @fopen((file_exists("adminer.sql") ? "adminer.sql"
: (file_exists("adminer.sql.gz") ? "compress.zlib://adminer.sql.gz"
: "compress.bzip2://adminer.sql.bz2"
)), "rb");
$fp = @fopen((file_exists("adminer.sql")
? "adminer.sql"
: "compress.zlib://adminer.sql.gz"
), "rb");
$query = ($fp ? fread($fp, 1e6) : false);
} elseif ($_FILES && $_FILES["sql_file"]["error"][0] != 4) { // 4 - UPLOAD_ERR_NO_FILE
$query = get_file("sql_file", true);
@@ -194,13 +194,7 @@ echo checkbox("error_stops", 1, $_POST["error_stops"], lang('Stop on error')) .
echo checkbox("only_errors", 1, $_POST["only_errors"], lang('Show only errors')) . "\n";
print_fieldset("webfile", lang('From server'), $_POST["webfile"], "document.getElementById('form')['only_errors'].checked = true; ");
$compress = array();
foreach (array("gz" => "zlib", "bz2" => "bz2") as $key => $val) {
if (extension_loaded($val)) {
$compress[] = ".$key";
}
}
echo lang('Webserver file %s', "<code>adminer.sql" . ($compress ? "[" . implode("|", $compress) . "]" : "") . "</code>");
echo lang('Webserver file %s', "<code>adminer.sql" . (extension_loaded("zlib") ? "[.gz]" : "") . "</code>");
echo ' <input type="submit" name="webfile" value="' . lang('Run file') . '">';
echo "</div></fieldset>\n";