diff --git a/adminer/drivers/elastic.inc.php b/adminer/drivers/elastic.inc.php index fa9725dd..7a98285d 100644 --- a/adminer/drivers/elastic.inc.php +++ b/adminer/drivers/elastic.inc.php @@ -9,9 +9,10 @@ if (isset($_GET["elastic"])) { class Min_DB { var $extension = "JSON", $server_info, $errno, $error, $_url; - function query($path, $content = array()) { + function query($path, $content = array(), $method = 'GET') { @ini_set('track_errors', 1); // @ - may be disabled $file = @file_get_contents($this->_url . ($this->_db != "" ? "$this->_db/" : "") . $path, false, stream_context_create(array('http' => array( + 'method' => $method, 'content' => json_encode($content), 'ignore_errors' => 1, // available since PHP 5.2.10 )))); @@ -278,6 +279,15 @@ if (isset($_GET["elastic"])) { return null; } + /** Create database + * @param string + * @return mixed + */ + function create_database($db) { + global $connection; + return $connection->query(urlencode($db), array(), 'PUT'); + } + $jush = "elastic"; $operators = array("=", "query"); $functions = array();