]> git.joonet.de Git - adminer.git/commitdiff
Reduce memory used by TAR export
authorJakub Vrana <jakub@vrana.cz>
Mon, 29 Apr 2013 22:45:15 +0000 (15:45 -0700)
committerJakub Vrana <jakub@vrana.cz>
Mon, 29 Apr 2013 22:45:15 +0000 (15:45 -0700)
adminer/dump.inc.php
adminer/include/editing.inc.php
todo.txt

index 5d456d2a45f56d51d1ba6ce8baa372fdb17619dd..78ade4ee4d6c5bbd38b3e3a4b651df3a71ed35d1 100644 (file)
@@ -84,7 +84,7 @@ SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
                                                        echo "\nDELIMITER ;;\n$triggers\nDELIMITER ;\n";
                                                }
                                                if ($ext == "tar") {
-                                                       echo tar_file((DB != "" ? "" : "$db/") . "$name.csv", ob_get_clean());
+                                                       tar_file((DB != "" ? "" : "$db/") . "$name.csv", ob_get_clean());
                                                } elseif ($is_sql) {
                                                        echo "\n";
                                                }
index 08c41966a14ea5b2676a8cbf291cad2ebd02bd3c..da42e32334d702e6540318c3bf0022320802fb9e 100644 (file)
@@ -412,7 +412,7 @@ function remove_definer($query) {
 /** Get string to add a file in TAR
 * @param string
 * @param string
-* @return string
+* @return null prints the output
 */
 function tar_file($filename, $contents) {
        $return = pack("a100a8a8a8a12a12", $filename, 644, 0, 0, decoct(strlen($contents)), decoct(time()));
@@ -421,7 +421,10 @@ function tar_file($filename, $contents) {
                $checksum += ord($return[$i]);
        }
        $return .= sprintf("%06o", $checksum) . "\0 ";
-       return $return . str_repeat("\0", 512 - strlen($return)) . $contents . str_repeat("\0", 511 - (strlen($contents) + 511) % 512);
+       echo $return;
+       echo str_repeat("\0", 512 - strlen($return));
+       echo $contents;
+       echo str_repeat("\0", 511 - (strlen($contents) + 511) % 512);
 }
 
 /** Get INI bytes value
index f1b63c711714900fd24094d6706296e4e1ccdb35..f682ba0cead009c28145521a1c93351f07e4f6c2 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
-Files are missing in TAR
+Files are missing in TAR due to exhausted memory - can be fixed by creating a temporary file
 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