mirror of
https://github.com/vrana/adminer.git
synced 2025-08-08 23:57:29 +02:00
Plugins: Add method dumpFooter()
This commit is contained in:
@@ -140,9 +140,7 @@ SET foreign_key_checks = 0;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($is_sql) {
|
$adminer->dumpFooter();
|
||||||
echo "-- " . gmdate("Y-m-d H:i:s e") . "\n";
|
|
||||||
}
|
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -945,6 +945,15 @@ class Adminer {
|
|||||||
return $ext;
|
return $ext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Print text after export
|
||||||
|
* @return null prints data
|
||||||
|
*/
|
||||||
|
function dumpFooter() {
|
||||||
|
if ($_POST["format"] == "sql") {
|
||||||
|
echo "-- " . gmdate("Y-m-d H:i:s e") . "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** Set the path of the file for webserver load
|
/** Set the path of the file for webserver load
|
||||||
* @return string path of the sql dump file
|
* @return string path of the sql dump file
|
||||||
*/
|
*/
|
||||||
|
@@ -100,6 +100,7 @@ if ($_POST && !$error) {
|
|||||||
$query = implode(" UNION ALL ", $union);
|
$query = implode(" UNION ALL ", $union);
|
||||||
}
|
}
|
||||||
$adminer->dumpData($TABLE, "table", $query);
|
$adminer->dumpData($TABLE, "table", $query);
|
||||||
|
$adminer->dumpFooter();
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -5,6 +5,7 @@ if (!$error && $_POST["export"]) {
|
|||||||
dump_headers("sql");
|
dump_headers("sql");
|
||||||
$adminer->dumpTable("", "");
|
$adminer->dumpTable("", "");
|
||||||
$adminer->dumpData("", "table", $_POST["query"]);
|
$adminer->dumpData("", "table", $_POST["query"]);
|
||||||
|
$adminer->dumpFooter();
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -9,6 +9,7 @@ MariaDB: Fix creating and altering generated columns (bug #897)
|
|||||||
SQLite: Fix creating table in compiled version (bug #901, regression from 5.0.0)
|
SQLite: Fix creating table in compiled version (bug #901, regression from 5.0.0)
|
||||||
Elastic: Do not pass null values on insert (PR #892)
|
Elastic: Do not pass null values on insert (PR #892)
|
||||||
Elastic: Fix displaying sparse rows (PR #893)
|
Elastic: Fix displaying sparse rows (PR #893)
|
||||||
|
Plugins: Add method dumpFooter()
|
||||||
|
|
||||||
Adminer 5.0.2 (released 2025-03-10):
|
Adminer 5.0.2 (released 2025-03-10):
|
||||||
PostgreSQL: Fix setting NULL and original value on enum (bug #884)
|
PostgreSQL: Fix setting NULL and original value on enum (bug #884)
|
||||||
|
@@ -574,6 +574,9 @@ qsl('div').onclick = whisperClick;", "")
|
|||||||
return $ext;
|
return $ext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function dumpFooter() {
|
||||||
|
}
|
||||||
|
|
||||||
function importServerPath() {
|
function importServerPath() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -19,10 +19,6 @@ class AdminerDumpJson {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function _database() {
|
|
||||||
echo "}\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
function dumpData($table, $style, $query) {
|
function dumpData($table, $style, $query) {
|
||||||
if ($_POST["format"] == "json") {
|
if ($_POST["format"] == "json") {
|
||||||
if ($this->database) {
|
if ($this->database) {
|
||||||
@@ -30,7 +26,6 @@ class AdminerDumpJson {
|
|||||||
} else {
|
} else {
|
||||||
$this->database = true;
|
$this->database = true;
|
||||||
echo "{\n";
|
echo "{\n";
|
||||||
register_shutdown_function(array($this, '_database'));
|
|
||||||
}
|
}
|
||||||
$connection = Adminer\connection();
|
$connection = Adminer\connection();
|
||||||
$result = $connection->query($query, 1);
|
$result = $connection->query($query, 1);
|
||||||
@@ -57,4 +52,10 @@ class AdminerDumpJson {
|
|||||||
return "json";
|
return "json";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function dumpFooter() {
|
||||||
|
if ($_POST["format"] == "json" && $this->database) {
|
||||||
|
echo "}\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -7,7 +7,6 @@
|
|||||||
*/
|
*/
|
||||||
class AdminerDumpPhp {
|
class AdminerDumpPhp {
|
||||||
protected $output = array();
|
protected $output = array();
|
||||||
protected $shutdown_callback = false;
|
|
||||||
|
|
||||||
function dumpFormat() {
|
function dumpFormat() {
|
||||||
return array('php' => 'PHP');
|
return array('php' => 'PHP');
|
||||||
@@ -23,10 +22,6 @@ class AdminerDumpPhp {
|
|||||||
function dumpTable($table, $style, $is_view = 0) {
|
function dumpTable($table, $style, $is_view = 0) {
|
||||||
if ($_POST['format'] == 'php') {
|
if ($_POST['format'] == 'php') {
|
||||||
$this->output[$table] = array();
|
$this->output[$table] = array();
|
||||||
if (!$this->shutdown_callback) {
|
|
||||||
$this->shutdown_callback = true;
|
|
||||||
register_shutdown_function(array($this, '_export'));
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -44,8 +39,11 @@ class AdminerDumpPhp {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function _export() {
|
function dumpFooter() {
|
||||||
echo "<?php\n";
|
if ($_POST['format'] == 'php') {
|
||||||
var_export($this->output);
|
echo "<?php\n";
|
||||||
|
var_export($this->output);
|
||||||
|
echo ";\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -19,16 +19,11 @@ class AdminerDumpXml {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function _database() {
|
|
||||||
echo "</database>\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
function dumpData($table, $style, $query) {
|
function dumpData($table, $style, $query) {
|
||||||
if ($_POST["format"] == "xml") {
|
if ($_POST["format"] == "xml") {
|
||||||
if (!$this->database) {
|
if (!$this->database) {
|
||||||
$this->database = true;
|
$this->database = true;
|
||||||
echo "<database name='" . Adminer\h(Adminer\DB) . "'>\n";
|
echo "<database name='" . Adminer\h(Adminer\DB) . "'>\n";
|
||||||
register_shutdown_function(array($this, '_database'));
|
|
||||||
}
|
}
|
||||||
$connection = Adminer\connection();
|
$connection = Adminer\connection();
|
||||||
$result = $connection->query($query, 1);
|
$result = $connection->query($query, 1);
|
||||||
@@ -51,4 +46,10 @@ class AdminerDumpXml {
|
|||||||
return "xml";
|
return "xml";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function dumpFooter() {
|
||||||
|
if ($_POST["format"] == "xml" && $this->database) {
|
||||||
|
echo "</database>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -387,6 +387,11 @@ class AdminerPlugin extends Adminer\Adminer {
|
|||||||
return $this->applyPlugin(__FUNCTION__, $args);
|
return $this->applyPlugin(__FUNCTION__, $args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function dumpFooter() {
|
||||||
|
$args = func_get_args();
|
||||||
|
return $this->applyPlugin(__FUNCTION__, $args);
|
||||||
|
}
|
||||||
|
|
||||||
function importServerPath() {
|
function importServerPath() {
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
return $this->applyPlugin(__FUNCTION__, $args);
|
return $this->applyPlugin(__FUNCTION__, $args);
|
||||||
|
Reference in New Issue
Block a user