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";
|
||||
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
|
||||
$databases = (support("scheme") ? schemas() : get_databases());
|
||||
$databases = (support("scheme") ? schemas() : $adminer->databases());
|
||||
if (count($databases) != 1 && $jush != "sqlite") {
|
||||
$db = (isset($_POST["target"]) ? $_POST["target"] : (support("scheme") ? $_GET["ns"] : DB));
|
||||
echo "<p>" . lang('Move to other database') . ": ";
|
||||
|
|
|
@ -208,7 +208,7 @@ if (DB != "") {
|
|||
echo $views;
|
||||
} 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";
|
||||
$databases = get_databases();
|
||||
$databases = $adminer->databases();
|
||||
if ($databases) {
|
||||
foreach ($databases as $db) {
|
||||
if (!information_schema($db)) {
|
||||
|
|
|
@ -34,6 +34,14 @@ class Adminer {
|
|||
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
|
||||
* @return bool true to send security headers
|
||||
*/
|
||||
|
@ -753,7 +761,7 @@ DROP PROCEDURE adminer_alter;
|
|||
}
|
||||
}
|
||||
} else {
|
||||
$databases = get_databases();
|
||||
$databases = $this->databases();
|
||||
?>
|
||||
<form action="" method="post">
|
||||
<p class="logout">
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
function connect_error() {
|
||||
global $connection, $token, $error, $drivers;
|
||||
global $adminer, $connection, $token, $error, $drivers;
|
||||
$databases = array();
|
||||
if (DB != "") {
|
||||
page_header(lang('Database') . ": " . h(DB), lang('Invalid database.'), true);
|
||||
|
@ -26,7 +26,7 @@ function connect_error() {
|
|||
if ($_GET["refresh"]) {
|
||||
set_session("dbs", null);
|
||||
}
|
||||
$databases = get_databases();
|
||||
$databases = $adminer->databases();
|
||||
if ($databases) {
|
||||
$scheme = support("scheme");
|
||||
$collations = collations();
|
||||
|
|
|
@ -28,7 +28,7 @@ if ($_GET["script"] == "db") {
|
|||
}
|
||||
json_row("");
|
||||
} 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("");
|
||||
|
|
|
@ -9,6 +9,7 @@ Esc to cancel AJAX request
|
|||
Move AJAX loading indicator to the right
|
||||
Don't quote bit type in export
|
||||
Ability to disable export (customization)
|
||||
Extensible list of databases (customization)
|
||||
MySQL: set autocommit after connect
|
||||
PostgreSQL: fix alter foreign key
|
||||
PostgreSQL, SQLite: don't use LIKE for numbers (bug #3420408)
|
||||
|
|
|
@ -19,13 +19,17 @@ class Adminer {
|
|||
|
||||
function database() {
|
||||
global $connection;
|
||||
$databases = get_databases(false);
|
||||
$databases = $this->databases(false);
|
||||
return (!$databases
|
||||
? $connection->result("SELECT SUBSTRING_INDEX(CURRENT_USER, '@', 1)") // username without the database list
|
||||
: $databases[(information_schema($databases[0]) ? 1 : 0)] // first available database
|
||||
);
|
||||
}
|
||||
|
||||
function databases($flush = true) {
|
||||
return get_databases($flush);
|
||||
}
|
||||
|
||||
function headers() {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -111,6 +111,11 @@ class AdminerPlugin extends Adminer {
|
|||
return $this->_applyPlugin(__FUNCTION__, $args);
|
||||
}
|
||||
|
||||
function databases() {
|
||||
$args = func_get_args();
|
||||
return $this->_applyPlugin(__FUNCTION__, $args);
|
||||
}
|
||||
|
||||
function headers() {
|
||||
$args = func_get_args();
|
||||
return $this->_applyPlugin(__FUNCTION__, $args);
|
||||
|
|
Loading…
Reference in a new issue