1
0
mirror of https://github.com/vrana/adminer.git synced 2025-09-03 03:13:00 +02:00

Compatibility with Elasticsearch 7.14

- Removed empty body from requests.
- Fix deleting records.
This commit is contained in:
Peter Knut
2021-09-18 23:05:43 +02:00
parent 49effeff09
commit c3e2e6c58f

View File

@@ -231,10 +231,10 @@ if (isset($_GET["elastic"])) {
function delete($type, $queryWhere, $limit = 0) {
//! use $limit
$ids = array();
if (is_array($_GET["where"]) && $_GET["where"]["_id"]) {
if (isset($_GET["where"]["_id"]) && $_GET["where"]["_id"]) {
$ids[] = $_GET["where"]["_id"];
}
if (is_array($_POST['check'])) {
if (isset($_POST['check'])) {
foreach ($_POST['check'] as $check) {
$parts = preg_split('~ *= *~', $check);
if (count($parts) == 2) {
@@ -245,8 +245,8 @@ if (isset($_GET["elastic"])) {
$this->_conn->affected_rows = 0;
foreach ($ids as $id) {
$query = "{$type}/{$id}";
$response = $this->_conn->query($query, '{}', 'DELETE');
if (is_array($response) && $response['found'] == true) {
$response = $this->_conn->query($query, null, 'DELETE');
if ((isset($response['found']) && $response['found']) || (isset($response['result']) && $response['result'] == 'deleted')) {
$this->_conn->affected_rows++;
}
}
@@ -474,7 +474,7 @@ if (isset($_GET["elastic"])) {
*/
function drop_databases($databases) {
global $connection;
return $connection->rootQuery(urlencode(implode(',', $databases)), array(), 'DELETE');
return $connection->rootQuery(urlencode(implode(',', $databases)), null, 'DELETE');
}
/** Alter type
@@ -505,7 +505,7 @@ if (isset($_GET["elastic"])) {
global $connection;
$return = true;
foreach ($tables as $table) { //! convert to bulk api
$return = $return && $connection->query(urlencode($table), array(), 'DELETE');
$return = $return && $connection->query(urlencode($table), null, 'DELETE');
}
return $return;
}