]> git.joonet.de Git - adminer.git/commitdiff
Remove bzip2 compression support
authorJakub Vrana <jakub@vrana.cz>
Mon, 29 Apr 2013 21:00:35 +0000 (14:00 -0700)
committerJakub Vrana <jakub@vrana.cz>
Mon, 29 Apr 2013 22:37:33 +0000 (15:37 -0700)
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').

adminer/include/adminer.inc.php
adminer/include/functions.inc.php
adminer/sql.inc.php
changes.txt
todo.txt

index 0a92e068be2d17d37d87f280e709b75d244c60c0..02bd4a978d53936205cc3f4433a43b2ad7194ccd 100644 (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);
                }
index 872ed5066ae2fe6f8110beb65eb63dd01fb4c191..a44a3daaf845f66f897195992ab28ae81909fe51 100644 (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
index 67d26d64ac83544512106801f9c3842f085c47b0..7ad14ef5dea0a21c506ff0f24c09ec4371ea21fc 100644 (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";
 
index 2f3890b95ad5309a57f27387c0e778de7bdf8336..4a3d670236a4b32085dfc442b2b1cd93e2a6fa75 100644 (file)
@@ -3,6 +3,7 @@ Allow more SQL files to be uploaded at the same time
 Print run time next to executed queries
 Disable SQL export when applying functions in select
 Allow using lang() in plugins (customization)
+Remove bzip2 compression support
 MySQL: Optimize create table page and Editor navigation
 MySQL: Display bit type as binary number
 MySQL: Improve export of binary data types
index 6448feba31e9fc008054e33f190c99f5c7435d52..f1b63c711714900fd24094d6706296e4e1ccdb35 100644 (file)
--- a/todo.txt
+++ b/todo.txt
@@ -4,7 +4,7 @@ Variables editation
 Blob download and image display in edit form (important for Editor with hidden fields in select and SQL command)
 Add title to Logout, edit (in select) and select (in menu) for style "hever"
 Export by GET parameters
-Only first part of big BZ2 export is readable, files are missing in TAR
+Files are missing in TAR
 Draggable columns in alter table (thanks to Michal Manak)
 <option class> for system databases and schemas - information_schema and driver-specific (thanks to Vaclav Novotny)
 Define foreign keys name - http://forum.zdrojak.root.cz/index.php?topic=185.msg1255#msg1255