Extensible list of databases
This commit is contained in:
parent
640afc74d7
commit
c7f1a6322e
|
@ -92,7 +92,7 @@ if ($adminer->homepage()) {
|
||||||
echo "<script type='text/javascript'>tableCheck();</script>\n";
|
echo "<script type='text/javascript'>tableCheck();</script>\n";
|
||||||
if (!information_schema(DB)) {
|
if (!information_schema(DB)) {
|
||||||
echo "<p>" . ($jush == "sql" ? "<input type='submit' value='" . lang('Analyze') . "'> <input type='submit' name='optimize' value='" . lang('Optimize') . "'> <input type='submit' name='check' value='" . lang('Check') . "'> <input type='submit' name='repair' value='" . lang('Repair') . "'> " : "") . "<input type='submit' name='truncate' value='" . lang('Truncate') . "'" . confirm("formChecked(this, /tables/)") . "> <input type='submit' name='drop' value='" . lang('Drop') . "'" . confirm("formChecked(this, /tables|views/)", 1) . ">\n"; // 1 - eventStop
|
echo "<p>" . ($jush == "sql" ? "<input type='submit' value='" . lang('Analyze') . "'> <input type='submit' name='optimize' value='" . lang('Optimize') . "'> <input type='submit' name='check' value='" . lang('Check') . "'> <input type='submit' name='repair' value='" . lang('Repair') . "'> " : "") . "<input type='submit' name='truncate' value='" . lang('Truncate') . "'" . confirm("formChecked(this, /tables/)") . "> <input type='submit' name='drop' value='" . lang('Drop') . "'" . confirm("formChecked(this, /tables|views/)", 1) . ">\n"; // 1 - eventStop
|
||||||
$databases = (support("scheme") ? schemas() : get_databases());
|
$databases = (support("scheme") ? schemas() : $adminer->databases());
|
||||||
if (count($databases) != 1 && $jush != "sqlite") {
|
if (count($databases) != 1 && $jush != "sqlite") {
|
||||||
$db = (isset($_POST["target"]) ? $_POST["target"] : (support("scheme") ? $_GET["ns"] : DB));
|
$db = (isset($_POST["target"]) ? $_POST["target"] : (support("scheme") ? $_GET["ns"] : DB));
|
||||||
echo "<p>" . lang('Move to other database') . ": ";
|
echo "<p>" . lang('Move to other database') . ": ";
|
||||||
|
|
|
@ -208,7 +208,7 @@ if (DB != "") {
|
||||||
echo $views;
|
echo $views;
|
||||||
} else {
|
} else {
|
||||||
echo "<thead><tr><th style='text-align: left;'><label><input type='checkbox' id='check-databases'" . ($TABLE == "" ? " checked" : "") . " onclick='formCheck(this, /^databases\\[/);'>" . lang('Database') . "</label></thead>\n";
|
echo "<thead><tr><th style='text-align: left;'><label><input type='checkbox' id='check-databases'" . ($TABLE == "" ? " checked" : "") . " onclick='formCheck(this, /^databases\\[/);'>" . lang('Database') . "</label></thead>\n";
|
||||||
$databases = get_databases();
|
$databases = $adminer->databases();
|
||||||
if ($databases) {
|
if ($databases) {
|
||||||
foreach ($databases as $db) {
|
foreach ($databases as $db) {
|
||||||
if (!information_schema($db)) {
|
if (!information_schema($db)) {
|
||||||
|
|
|
@ -34,6 +34,14 @@ class Adminer {
|
||||||
return DB;
|
return DB;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Get cached list of databases
|
||||||
|
* @param bool
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
function databases($flush = true) {
|
||||||
|
return get_databases($flush);
|
||||||
|
}
|
||||||
|
|
||||||
/** Headers to send before HTML output
|
/** Headers to send before HTML output
|
||||||
* @return bool true to send security headers
|
* @return bool true to send security headers
|
||||||
*/
|
*/
|
||||||
|
@ -753,7 +761,7 @@ DROP PROCEDURE adminer_alter;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$databases = get_databases();
|
$databases = $this->databases();
|
||||||
?>
|
?>
|
||||||
<form action="" method="post">
|
<form action="" method="post">
|
||||||
<p class="logout">
|
<p class="logout">
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
function connect_error() {
|
function connect_error() {
|
||||||
global $connection, $token, $error, $drivers;
|
global $adminer, $connection, $token, $error, $drivers;
|
||||||
$databases = array();
|
$databases = array();
|
||||||
if (DB != "") {
|
if (DB != "") {
|
||||||
page_header(lang('Database') . ": " . h(DB), lang('Invalid database.'), true);
|
page_header(lang('Database') . ": " . h(DB), lang('Invalid database.'), true);
|
||||||
|
@ -26,7 +26,7 @@ function connect_error() {
|
||||||
if ($_GET["refresh"]) {
|
if ($_GET["refresh"]) {
|
||||||
set_session("dbs", null);
|
set_session("dbs", null);
|
||||||
}
|
}
|
||||||
$databases = get_databases();
|
$databases = $adminer->databases();
|
||||||
if ($databases) {
|
if ($databases) {
|
||||||
$scheme = support("scheme");
|
$scheme = support("scheme");
|
||||||
$collations = collations();
|
$collations = collations();
|
||||||
|
|
|
@ -28,7 +28,7 @@ if ($_GET["script"] == "db") {
|
||||||
}
|
}
|
||||||
json_row("");
|
json_row("");
|
||||||
} else { // connect
|
} else { // connect
|
||||||
foreach (count_tables(get_databases()) as $db => $val) {
|
foreach (count_tables($adminer->databases()) as $db => $val) {
|
||||||
json_row("tables-" . js_escape($db), $val);
|
json_row("tables-" . js_escape($db), $val);
|
||||||
}
|
}
|
||||||
json_row("");
|
json_row("");
|
||||||
|
|
|
@ -9,6 +9,7 @@ Esc to cancel AJAX request
|
||||||
Move AJAX loading indicator to the right
|
Move AJAX loading indicator to the right
|
||||||
Don't quote bit type in export
|
Don't quote bit type in export
|
||||||
Ability to disable export (customization)
|
Ability to disable export (customization)
|
||||||
|
Extensible list of databases (customization)
|
||||||
MySQL: set autocommit after connect
|
MySQL: set autocommit after connect
|
||||||
PostgreSQL: fix alter foreign key
|
PostgreSQL: fix alter foreign key
|
||||||
PostgreSQL, SQLite: don't use LIKE for numbers (bug #3420408)
|
PostgreSQL, SQLite: don't use LIKE for numbers (bug #3420408)
|
||||||
|
|
|
@ -19,13 +19,17 @@ class Adminer {
|
||||||
|
|
||||||
function database() {
|
function database() {
|
||||||
global $connection;
|
global $connection;
|
||||||
$databases = get_databases(false);
|
$databases = $this->databases(false);
|
||||||
return (!$databases
|
return (!$databases
|
||||||
? $connection->result("SELECT SUBSTRING_INDEX(CURRENT_USER, '@', 1)") // username without the database list
|
? $connection->result("SELECT SUBSTRING_INDEX(CURRENT_USER, '@', 1)") // username without the database list
|
||||||
: $databases[(information_schema($databases[0]) ? 1 : 0)] // first available database
|
: $databases[(information_schema($databases[0]) ? 1 : 0)] // first available database
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function databases($flush = true) {
|
||||||
|
return get_databases($flush);
|
||||||
|
}
|
||||||
|
|
||||||
function headers() {
|
function headers() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,6 +111,11 @@ class AdminerPlugin extends Adminer {
|
||||||
return $this->_applyPlugin(__FUNCTION__, $args);
|
return $this->_applyPlugin(__FUNCTION__, $args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function databases() {
|
||||||
|
$args = func_get_args();
|
||||||
|
return $this->_applyPlugin(__FUNCTION__, $args);
|
||||||
|
}
|
||||||
|
|
||||||
function headers() {
|
function headers() {
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
return $this->_applyPlugin(__FUNCTION__, $args);
|
return $this->_applyPlugin(__FUNCTION__, $args);
|
||||||
|
|
Loading…
Reference in a new issue