Permalink
Browse files

Zip dump only if requested

  • Loading branch information...
1 parent 5b57706 commit f158d5e3926e502339b7695fdc5b2f72eaaa83b8 @vrana committed Jun 29, 2012
Showing with 4 additions and 5 deletions.
  1. +4 −5 plugins/dump-zip.php
View
@@ -8,7 +8,7 @@
*/
class AdminerDumpZip {
/** @access protected */
- var $filename;
+ var $filename, $data;
function dumpOutput() {
if (!class_exists('ZipArchive')) {
@@ -18,13 +18,12 @@ function dumpOutput() {
}
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 @@ function dumpHeaders($identifier, $multi_table = false) {
$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'));
}
}

0 comments on commit f158d5e

Please sign in to comment.