From f158d5e3926e502339b7695fdc5b2f72eaaa83b8 Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Fri, 29 Jun 2012 14:09:44 -0700 Subject: [PATCH] Zip dump only if requested --- plugins/dump-zip.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/plugins/dump-zip.php b/plugins/dump-zip.php index 0d2bf642..5b8efd54 100644 --- a/plugins/dump-zip.php +++ b/plugins/dump-zip.php @@ -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')); } } -- 2.39.5