]> git.joonet.de Git - adminer.git/commitdiff
Zip dump only if requested
authorJakub Vrana <jakub@vrana.cz>
Fri, 29 Jun 2012 21:09:44 +0000 (14:09 -0700)
committerJakub Vrana <jakub@vrana.cz>
Fri, 29 Jun 2012 21:09:44 +0000 (14:09 -0700)
plugins/dump-zip.php

index 0d2bf642a151fff0b0d9078d9c83a75bc17332c8..5b8efd542fe3023ca07a250d19c8a0a240eaf686 100644 (file)
@@ -8,7 +8,7 @@
 */
 class AdminerDumpZip {
        /** @access protected */
-       var $filename;
+       var $filename, $data;
        
        function dumpOutput() {
                if (!class_exists('ZipArchive')) {
@@ -18,13 +18,12 @@ class AdminerDumpZip {
        }
        
        function _zip($string, $state) {
-               static $data = "";
-               $data .= $string;
+               $this->data .= $string;
                if ($state & PHP_OUTPUT_HANDLER_END) {
                        $zip = new ZipArchive;
                        $zipFile = tempnam("", "zip");
                        $zip->open($zipFile, ZipArchive::OVERWRITE); // php://output is not supported
-                       $zip->addFromString($this->filename, $data);
+                       $zip->addFromString($this->filename, $this->data);
                        $zip->close();
                        $return = file_get_contents($zipFile);
                        unlink($zipFile);
@@ -37,8 +36,8 @@ class AdminerDumpZip {
                $this->filename = "$identifier." . ($multi_table && ereg("[ct]sv", $_POST["format"]) ? "tar" : $_POST["format"]);
                if ($_POST["output"] == "zip") {
                        header("Content-Type: application/zip");
+                       ob_start(array($this, '_zip'));
                }
-               ob_start(array($this, '_zip'));
        }
 
 }