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

Bzip2 compression

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1036 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
jakubvrana
2009-08-28 14:44:43 +00:00
parent 2f272b05e0
commit 702e949d30
4 changed files with 35 additions and 16 deletions

View File

@@ -360,9 +360,18 @@ function process_input($field) {
}
}
function dump($string) {
if ($_POST["compress"] == "gz") {
echo gzencode($string);
function dump($string = null) { // null $string forces sending of buffer
static $buffer = ""; // used to improve compression and to allow GZ archives unpackable in Total Commander
if ($_POST["compress"]) {
$buffer .= $string;
if (!isset($string) || strlen($buffer) > 1e6) {
if ($_POST["compress"] == "bz2") {
echo bzcompress($buffer); // should not be called repeatedly but it would require whole buffer in memory or temporary file
} else {
echo gzencode($buffer);
}
$buffer = "";
}
} else {
echo $string;
}