Elasticsearch: Implemented function create_database()

This commit is contained in:
Tomas Lang 2014-01-09 22:27:06 +01:00 committed by Jakub Vrana
parent be0c1e1b49
commit 9ac04aa5b9

View 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();