1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-08 07:36:44 +02:00

Always return array from table_status()

This commit is contained in:
Jakub Vrana
2025-03-26 01:34:48 +01:00
parent cd207238b7
commit cccc784da4
19 changed files with 28 additions and 49 deletions

View File

@@ -309,9 +309,6 @@ if (isset($_GET["clickhouse"])) {
'Name' => $table['name'],
'Engine' => $table['engine'],
);
if ($name === $table['name']) {
return $return[$table['name']];
}
}
return $return;
}

View File

@@ -384,16 +384,17 @@ if (isset($_GET["elastic"])) {
if ($name != "") {
if (isset($stats["indices"][$name])) {
return format_index_status($name, $stats["indices"][$name]);
return array(format_index_status($name, $stats["indices"][$name]));
} else {
foreach ($aliases as $index_name => $index) {
foreach ($index["aliases"] as $alias_name => $alias) {
if ($alias_name == $name) {
return format_alias_status($alias_name, $stats["indices"][$index_name]);
return array(format_alias_status($alias_name, $stats["indices"][$index_name]));
}
}
}
}
return array();
}
ksort($stats["indices"]);

View File

@@ -184,16 +184,13 @@ if (isset($_GET["firebird"])) {
function table_status($name = "", $fast = false) {
$connection = connection();
$return = array();
$data = tables_list();
$data = ($name != "" ? array($name => 1) : tables_list());
foreach ($data as $index => $val) {
$index = trim($index);
$return[$index] = array(
'Name' => $index,
'Engine' => 'standard',
);
if ($name == $index) {
return $return[$index];
}
}
return $return;
}

View File

@@ -44,7 +44,7 @@ if (isset($_GET["imap"])) {
preg_match_all('~"uid" = (\d+)~', $query, $matches);
return imap_delete($this->imap, implode(",", $matches[1]), FT_UID);
} elseif (preg_match('~^SELECT COUNT\(\*\)\sFROM "(.+?)"~s', $query, $match)) {
$status = table_status($match[1]);
$status = table_status1($match[1]);
return new Result(array(array($status["Rows"])));
} elseif (preg_match('~^SELECT (.+)\sFROM "(.+?)"(?:\sWHERE "uid" = (\d+))?.*?(?:\sLIMIT (\d+)(?:\sOFFSET (\d+))?)?~s', $query, $match)) {
list(, $columns, $table, $uid, $limit, $offset) = $match;
@@ -233,11 +233,8 @@ if (isset($_GET["imap"])) {
}
function table_status($name = "", $fast = false) {
if ($name != "") {
return connection()->table_status($name, $fast);
}
$return = array();
foreach (tables_list() as $table => $type) {
foreach (($name != "" ? array($name => 1) : tables_list()) as $table => $type) {
$return[$table] = connection()->table_status($table, $fast);
}
return $return;

View File

@@ -391,11 +391,8 @@ if (isset($_GET["mongo"])) {
function table_status($name = "", $fast = false) {
$return = array();
foreach (tables_list() as $table => $type) {
$return[$table] = array("Name" => $table);
if ($name == $table) {
return $return[$table];
}
foreach (($name != "" ? array($name => 1) : tables_list()) as $table => $type) {
$return[$table] = array("Name" => $table, "Engine" => "");
}
return $return;
}

View File

@@ -316,9 +316,6 @@ if (isset($_GET["simpledb"])) {
}
}
}
if ($name != "") {
return $row;
}
$return[$table] = $row;
}
return $return;