2010-10-15 09:26:42 +00:00
|
|
|
<?php
|
|
|
|
header("Content-Type: text/javascript; charset=utf-8");
|
|
|
|
|
|
|
|
if ($_GET["script"] == "db") {
|
|
|
|
$sums = array("Data_length" => 0, "Index_length" => 0, "Data_free" => 0);
|
2011-07-29 14:42:44 +00:00
|
|
|
foreach (table_status() as $table_status) {
|
|
|
|
$id = js_escape($table_status["Name"]);
|
|
|
|
json_row("Comment-$id", nbsp($table_status["Comment"]));
|
|
|
|
if (!is_view($table_status)) {
|
2010-10-15 09:26:42 +00:00
|
|
|
foreach (array("Engine", "Collation") as $key) {
|
2011-07-29 14:42:44 +00:00
|
|
|
json_row("$key-$id", nbsp($table_status[$key]));
|
2010-10-15 09:26:42 +00:00
|
|
|
}
|
|
|
|
foreach ($sums + array("Auto_increment" => 0, "Rows" => 0) as $key => $val) {
|
2011-07-29 14:42:44 +00:00
|
|
|
if ($table_status[$key] != "") {
|
|
|
|
$val = number_format($table_status[$key], 0, '.', lang(','));
|
2012-07-29 17:45:38 +00:00
|
|
|
json_row("$key-$id", ($key == "Rows" && $val && $table_status["Engine"] == ($sql == "pgsql" ? "table" : "InnoDB")
|
|
|
|
? "~ $val"
|
|
|
|
: $val
|
|
|
|
));
|
2010-10-15 09:26:42 +00:00
|
|
|
if (isset($sums[$key])) {
|
2012-05-16 14:44:44 +00:00
|
|
|
// ignore innodb_file_per_table because it is not active for tables created before it was enabled
|
2011-07-29 14:42:44 +00:00
|
|
|
$sums[$key] += ($table_status["Engine"] != "InnoDB" || $key != "Data_free" ? $table_status[$key] : 0);
|
2010-10-15 09:26:42 +00:00
|
|
|
}
|
2011-07-29 14:42:44 +00:00
|
|
|
} elseif (array_key_exists($key, $table_status)) {
|
2010-10-18 23:40:49 +00:00
|
|
|
json_row("$key-$id");
|
2010-10-15 09:26:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
foreach ($sums as $key => $val) {
|
2010-10-18 23:40:49 +00:00
|
|
|
json_row("sum-$key", number_format($val, 0, '.', lang(',')));
|
2010-10-15 09:26:42 +00:00
|
|
|
}
|
2010-10-18 23:40:49 +00:00
|
|
|
json_row("");
|
2012-08-20 00:12:19 +00:00
|
|
|
|
|
|
|
} elseif ($_GET["script"] == "kill") {
|
2012-08-20 04:55:00 +00:00
|
|
|
$connection->query("KILL " . (+$_POST["kill"]));
|
2012-08-20 00:12:19 +00:00
|
|
|
|
2010-10-15 09:26:42 +00:00
|
|
|
} else { // connect
|
2012-02-24 06:54:48 +00:00
|
|
|
foreach (count_tables($adminer->databases()) as $db => $val) {
|
2010-11-12 16:31:18 +00:00
|
|
|
json_row("tables-" . js_escape($db), $val);
|
2010-10-15 09:26:42 +00:00
|
|
|
}
|
2010-10-18 23:40:49 +00:00
|
|
|
json_row("");
|
2010-10-15 09:26:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
exit; // don't print footer
|