mirror of
https://github.com/vrana/adminer.git
synced 2025-08-15 11:04:02 +02:00
Optimize table_status()
This commit is contained in:
@@ -777,7 +777,7 @@ username.form['auth[driver]'].onchange();
|
||||
$this->databasesPrint($missing);
|
||||
if ($_GET["ns"] !== "" && !$missing && DB != "") {
|
||||
echo '<p><a href="' . h(ME) . 'create="' . bold($_GET["create"] === "") . ">" . lang('Create new table') . "</a>\n";
|
||||
$tables = tables_list();
|
||||
$tables = table_status('', true);
|
||||
if (!$tables) {
|
||||
echo "<p class='message'>" . lang('No tables.') . "\n";
|
||||
} else {
|
||||
@@ -832,14 +832,14 @@ echo ($databases
|
||||
}
|
||||
|
||||
/** Prints table list in menu
|
||||
* @param array
|
||||
* @param array result of table_status('', true)
|
||||
* @return null
|
||||
*/
|
||||
function tablesPrint($tables) {
|
||||
echo "<p id='tables' onmouseover='menuOver(this, event);' onmouseout='menuOut(this);'>\n";
|
||||
foreach ($tables as $table => $type) {
|
||||
foreach ($tables as $table => $status) {
|
||||
echo '<a href="' . h(ME) . 'select=' . urlencode($table) . '"' . bold($_GET["select"] == $table) . ">" . lang('select') . "</a> ";
|
||||
echo '<a href="' . h(ME) . 'table=' . urlencode($table) . '"' . bold($_GET["table"] == $table) . " title='" . lang('Show structure') . "'>" . $this->tableName(array("Name" => $table)) . "</a><br>\n"; //! Adminer::tableName may work with full table status
|
||||
echo '<a href="' . h(ME) . 'table=' . urlencode($table) . '"' . bold($_GET["table"] == $table) . " title='" . lang('Show structure') . "'>" . $this->tableName($status) . "</a><br>\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -94,7 +94,7 @@ function select($result, $connection2 = null, $href = "", $orgtables = array())
|
||||
*/
|
||||
function referencable_primary($self) {
|
||||
$return = array(); // table_name => field
|
||||
foreach (table_status() as $table_name => $table) {
|
||||
foreach (table_status('', true) as $table_name => $table) {
|
||||
if ($table_name != $self && fk_support($table)) {
|
||||
foreach (fields($table_name) as $field) {
|
||||
if ($field["primary"]) {
|
||||
|
@@ -822,7 +822,7 @@ function search_tables() {
|
||||
$_GET["where"][0]["op"] = "LIKE %%";
|
||||
$_GET["where"][0]["val"] = $_POST["query"];
|
||||
$found = false;
|
||||
foreach (table_status() as $table => $table_status) {
|
||||
foreach (table_status('', true) as $table => $table_status) {
|
||||
$name = $adminer->tableName($table_status);
|
||||
if (isset($table_status["Engine"]) && $name != "" && (!$_POST["tables"] || in_array($table, $_POST["tables"]))) {
|
||||
$result = $connection->query("SELECT" . limit("1 FROM " . table($table), " WHERE " . implode(" AND ", $adminer->selectSearchProcess(fields($table), array())), 1));
|
||||
|
Reference in New Issue
Block a user