mirror of
https://github.com/vrana/adminer.git
synced 2026-01-21 23:13:06 +01:00
Separate JavaScript to not wait with Firebug
This commit is contained in:
35
adminer/script.inc.php
Normal file
35
adminer/script.inc.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
header("Content-Type: text/javascript; charset=utf-8");
|
||||
|
||||
if ($_GET["script"] == "db") {
|
||||
$sums = array("Data_length" => 0, "Index_length" => 0, "Data_free" => 0);
|
||||
foreach (table_status() as $row) {
|
||||
$id = addcslashes($row["Name"], "\\'/");
|
||||
echo "setHtml('Comment-$id', '" . nbsp($row["Comment"]) . "');\n";
|
||||
if (!is_view($row)) {
|
||||
foreach (array("Engine", "Collation") as $key) {
|
||||
echo "setHtml('$key-$id', '" . nbsp($row[$key]) . "');\n";
|
||||
}
|
||||
foreach ($sums + array("Auto_increment" => 0, "Rows" => 0) as $key => $val) {
|
||||
if ($row[$key] != "") {
|
||||
$val = number_format($row[$key], 0, '.', lang(','));
|
||||
echo "setHtml('$key-$id', '" . ($key == "Rows" && $row["Engine"] == "InnoDB" && $val ? "~ $val" : $val) . "');\n";
|
||||
if (isset($sums[$key])) {
|
||||
$sums[$key] += ($row["Engine"] != "InnoDB" || $key != "Data_free" ? $row[$key] : 0);
|
||||
}
|
||||
} elseif (array_key_exists($key, $row)) {
|
||||
echo "setHtml('$key-$id');\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach ($sums as $key => $val) {
|
||||
echo "setHtml('sum-$key', '" . number_format($val, 0, '.', lang(',')) . "');\n";
|
||||
}
|
||||
} else { // connect
|
||||
foreach (count_tables(get_databases()) as $db => $val) {
|
||||
echo "setHtml('tables-" . addcslashes($db, "\\'/") . "', '$val');\n";
|
||||
}
|
||||
}
|
||||
|
||||
exit; // don't print footer
|
||||
Reference in New Issue
Block a user