Elasticsearch: Implemented function create_database()
This commit is contained in:
parent
be0c1e1b49
commit
9ac04aa5b9
|
@ -9,9 +9,10 @@ if (isset($_GET["elastic"])) {
|
||||||
class Min_DB {
|
class Min_DB {
|
||||||
var $extension = "JSON", $server_info, $errno, $error, $_url;
|
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
|
@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(
|
$file = @file_get_contents($this->_url . ($this->_db != "" ? "$this->_db/" : "") . $path, false, stream_context_create(array('http' => array(
|
||||||
|
'method' => $method,
|
||||||
'content' => json_encode($content),
|
'content' => json_encode($content),
|
||||||
'ignore_errors' => 1, // available since PHP 5.2.10
|
'ignore_errors' => 1, // available since PHP 5.2.10
|
||||||
))));
|
))));
|
||||||
|
@ -278,6 +279,15 @@ if (isset($_GET["elastic"])) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Create database
|
||||||
|
* @param string
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
function create_database($db) {
|
||||||
|
global $connection;
|
||||||
|
return $connection->query(urlencode($db), array(), 'PUT');
|
||||||
|
}
|
||||||
|
|
||||||
$jush = "elastic";
|
$jush = "elastic";
|
||||||
$operators = array("=", "query");
|
$operators = array("=", "query");
|
||||||
$functions = array();
|
$functions = array();
|
||||||
|
|
Loading…
Reference in a new issue