Provide size of all databases in the overview
This commit is contained in:
parent
a710c28d38
commit
c369236333
|
@ -88,7 +88,7 @@ if (!ini_bool("session.use_cookies") || @ini_set("session.use_cookies", false) !
|
||||||
session_write_close(); // improves concurrency if a user opens several pages at once, may be restarted later
|
session_write_close(); // improves concurrency if a user opens several pages at once, may be restarted later
|
||||||
}
|
}
|
||||||
|
|
||||||
include "./include/connect.inc.php";
|
|
||||||
include "./include/editing.inc.php";
|
include "./include/editing.inc.php";
|
||||||
|
include "./include/connect.inc.php";
|
||||||
|
|
||||||
$on_actions = "RESTRICT|NO ACTION|CASCADE|SET NULL|SET DEFAULT"; ///< @var string used in foreign_keys()
|
$on_actions = "RESTRICT|NO ACTION|CASCADE|SET NULL|SET DEFAULT"; ///< @var string used in foreign_keys()
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
function connect_error() {
|
function connect_error() {
|
||||||
global $adminer, $connection, $token, $error, $drivers;
|
global $adminer, $connection, $token, $error, $drivers;
|
||||||
$databases = array();
|
|
||||||
if (DB != "") {
|
if (DB != "") {
|
||||||
header("HTTP/1.1 404 Not Found");
|
header("HTTP/1.1 404 Not Found");
|
||||||
page_header(lang('Database') . ": " . h(DB), lang('Invalid database.'), true);
|
page_header(lang('Database') . ": " . h(DB), lang('Invalid database.'), true);
|
||||||
|
@ -31,15 +30,25 @@ function connect_error() {
|
||||||
$collations = collations();
|
$collations = collations();
|
||||||
echo "<form action='' method='post'>\n";
|
echo "<form action='' method='post'>\n";
|
||||||
echo "<table cellspacing='0' class='checkable' onclick='tableClick(event);' ondblclick='tableClick(event, true);'>\n";
|
echo "<table cellspacing='0' class='checkable' onclick='tableClick(event);' ondblclick='tableClick(event, true);'>\n";
|
||||||
echo "<thead><tr>" . (support("database") ? "<td> " : "") . "<th>" . lang('Database') . "<td>" . lang('Collation') . "<td>" . lang('Tables') . "</thead>\n";
|
echo "<thead><tr>"
|
||||||
|
. (support("database") ? "<td> " : "")
|
||||||
|
. "<th>" . lang('Database')
|
||||||
|
. "<td>" . lang('Collation')
|
||||||
|
. "<td>" . lang('Tables')
|
||||||
|
. "<td>" . lang('Size') . " - <a href='" . h(ME) . "dbsize=1' onclick=\"return !ajaxSetHtml('" . js_escape(ME) . "script=connect');\">" . lang('Compute') . "</a>"
|
||||||
|
. "</thead>\n"
|
||||||
|
;
|
||||||
|
|
||||||
foreach ($databases as $db) {
|
$databases = ($_GET["dbsize"] ? count_tables($databases) : array_flip($databases));
|
||||||
|
|
||||||
|
foreach ($databases as $db => $tables) {
|
||||||
$root = h(ME) . "db=" . urlencode($db);
|
$root = h(ME) . "db=" . urlencode($db);
|
||||||
echo "<tr" . odd() . ">" . (support("database") ? "<td>" . checkbox("db[]", $db, in_array($db, (array) $_POST["db"])) : "");
|
echo "<tr" . odd() . ">" . (support("database") ? "<td>" . checkbox("db[]", $db, in_array($db, (array) $_POST["db"])) : "");
|
||||||
echo "<th><a href='$root'>" . h($db) . "</a>";
|
echo "<th><a href='$root'>" . h($db) . "</a>";
|
||||||
$collation = nbsp(db_collation($db, $collations));
|
$collation = nbsp(db_collation($db, $collations));
|
||||||
echo "<td>" . (support("database") ? "<a href='$root" . ($scheme ? "&ns=" : "") . "&database=' title='" . lang('Alter database') . "'>$collation</a>" : $collation);
|
echo "<td>" . (support("database") ? "<a href='$root" . ($scheme ? "&ns=" : "") . "&database=' title='" . lang('Alter database') . "'>$collation</a>" : $collation);
|
||||||
echo "<td align='right'><a href='$root&schema=' id='tables-" . h($db) . "' title='" . lang('Database schema') . "'>?</a>";
|
echo "<td align='right'><a href='$root&schema=' id='tables-" . h($db) . "' title='" . lang('Database schema') . "'>" . ($_GET["dbsize"] ? $tables : "?") . "</a>";
|
||||||
|
echo "<td align='right' id='size-" . h($db) . "'>" . ($_GET["dbsize"] ? db_size($db) : "?");
|
||||||
echo "\n";
|
echo "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,9 +68,6 @@ function connect_error() {
|
||||||
}
|
}
|
||||||
|
|
||||||
page_footer("db");
|
page_footer("db");
|
||||||
if ($databases) {
|
|
||||||
echo "<script type='text/javascript'>ajaxSetHtml('" . js_escape(ME) . "script=connect');</script>\n";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_GET["status"])) {
|
if (isset($_GET["status"])) {
|
||||||
|
|
|
@ -505,3 +505,19 @@ function ob_gzencode($string) {
|
||||||
// ob_start() callback recieves an optional parameter $phase but gzencode() accepts optional parameter $level
|
// ob_start() callback recieves an optional parameter $phase but gzencode() accepts optional parameter $level
|
||||||
return gzencode($string);
|
return gzencode($string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Compute size of database
|
||||||
|
* @param string
|
||||||
|
* @return string formatted
|
||||||
|
*/
|
||||||
|
function db_size($db) {
|
||||||
|
global $connection;
|
||||||
|
if (!$connection->select_db($db)) {
|
||||||
|
return "?";
|
||||||
|
}
|
||||||
|
$return = 0;
|
||||||
|
foreach (table_status() as $table_status) {
|
||||||
|
$return += $table_status["Data_length"] + $table_status["Index_length"];
|
||||||
|
}
|
||||||
|
return number_format($return, 0, '.', lang(','));
|
||||||
|
}
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
<?php
|
<?php
|
||||||
$VERSION = "4.0.4-dev";
|
$VERSION = "4.1.0-dev";
|
||||||
|
|
|
@ -165,6 +165,8 @@ $translations = array(
|
||||||
'Default values' => 'Výchozí hodnoty',
|
'Default values' => 'Výchozí hodnoty',
|
||||||
'Drop' => 'Odstranit',
|
'Drop' => 'Odstranit',
|
||||||
'Are you sure?' => 'Opravdu?',
|
'Are you sure?' => 'Opravdu?',
|
||||||
|
'Size' => 'Velikost',
|
||||||
|
'Compute' => 'Spočítat',
|
||||||
'Move up' => 'Přesunout nahoru',
|
'Move up' => 'Přesunout nahoru',
|
||||||
'Move down' => 'Přesunout dolů',
|
'Move down' => 'Přesunout dolů',
|
||||||
'Remove' => 'Odebrat',
|
'Remove' => 'Odebrat',
|
||||||
|
|
|
@ -165,6 +165,8 @@ $translations = array(
|
||||||
'Default values' => 'xx',
|
'Default values' => 'xx',
|
||||||
'Drop' => 'xx',
|
'Drop' => 'xx',
|
||||||
'Are you sure?' => 'xx',
|
'Are you sure?' => 'xx',
|
||||||
|
'Size' => 'xx',
|
||||||
|
'Compute' => 'xx',
|
||||||
'Move up' => 'xx',
|
'Move up' => 'xx',
|
||||||
'Move down' => 'xx',
|
'Move down' => 'xx',
|
||||||
'Remove' => 'xx',
|
'Remove' => 'xx',
|
||||||
|
|
|
@ -37,7 +37,8 @@ if ($_GET["script"] == "db") {
|
||||||
|
|
||||||
} else { // connect
|
} else { // connect
|
||||||
foreach (count_tables($adminer->databases()) as $db => $val) {
|
foreach (count_tables($adminer->databases()) as $db => $val) {
|
||||||
json_row("tables-" . js_escape($db), $val);
|
json_row("tables-$db", $val);
|
||||||
|
json_row("size-$db", db_size($db));
|
||||||
}
|
}
|
||||||
json_row("");
|
json_row("");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
Adminer 4.0.4-dev:
|
Adminer 4.1.0-dev:
|
||||||
|
Provide size of all databases in the overview
|
||||||
|
Compute number of tables in the overview explicitly
|
||||||
Display edit form after error in clone or multi-edit
|
Display edit form after error in clone or multi-edit
|
||||||
Display time of the select command
|
Display time of the select command
|
||||||
Improve gzip export ratio (bug #387)
|
Improve gzip export ratio (bug #387)
|
||||||
|
|
Loading…
Reference in a new issue