]> git.joonet.de Git - adminer.git/commitdiff
Elasticsearch: Implemented function create_database()
authorTomas Lang <tomas.lang@smsbrana.cz>
Thu, 9 Jan 2014 21:27:06 +0000 (22:27 +0100)
committerJakub Vrana <jakub@vrana.cz>
Fri, 10 Jan 2014 06:26:39 +0000 (22:26 -0800)
adminer/drivers/elastic.inc.php

index fa9725dd6fe785fe33309f0058525b912824c0b6..7a98285dc8400380e7076f44fc50f9fce0975f5c 100644 (file)
@@ -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();