Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Extensible list of databases

  • Loading branch information...
commit c7f1a6322e0ce3565d7b0db9b98f20e4878ac765 1 parent 640afc7
@vrana authored
View
2  adminer/db.inc.php
@@ -92,7 +92,7 @@
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') . ": ";
View
2  adminer/dump.inc.php
@@ -208,7 +208,7 @@
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)) {
View
10 adminer/include/adminer.inc.php
@@ -34,6 +34,14 @@ function database() {
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 @@ function navigation($missing) {
}
}
} else {
- $databases = get_databases();
+ $databases = $this->databases();
?>
<form action="" method="post">
<p class="logout">
View
4 adminer/include/connect.inc.php
@@ -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();
View
2  adminer/script.inc.php
@@ -28,7 +28,7 @@
}
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("");
View
1  changes.txt
@@ -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)
View
6 editor/include/adminer.inc.php
@@ -19,13 +19,17 @@ function permanentLogin() {
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;
}
View
5 plugins/plugin.php
@@ -111,6 +111,11 @@ function database() {
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);
Please sign in to comment.
Something went wrong with that request. Please try again.