mirror of
https://github.com/vrana/adminer.git
synced 2025-08-08 07:36:44 +02:00
Zip dump only if requested
This commit is contained in:
@@ -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'));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user