X-Git-Url: https://git.cweiske.de/phorkie.git/blobdiff_plain/b06abebda261ebecd52c6c32e762ccf14e24cdbf..43b23197ffc3e1d08a1e08b09dbb31f06692d7ff:/src/phorkie/Database.php diff --git a/src/phorkie/Database.php b/src/phorkie/Database.php index 9df6d8c..1f214e8 100644 --- a/src/phorkie/Database.php +++ b/src/phorkie/Database.php @@ -3,16 +3,33 @@ namespace phorkie; class Database { + public $adapter = null; + public $prefix = '\phorkie\Database_Adapter_Null'; + + public function __construct() + { + if ($GLOBALS['phorkie']['cfg']['elasticsearch'] != '') { + $this->adapter = 'Elasticsearch'; + $this->prefix = '\phorkie\Database_Adapter_Elasticsearch'; + } + } public function getSearch() { - return new Search_Elasticsearch(); + $class = $this->prefix . '_Search'; + return new $class(); } public function getIndexer() { - return new Indexer_Elasticsearch(); + $class = $this->prefix . '_Indexer'; + return new $class(); } + public function getSetup() + { + $class = $this->prefix . '_Setup'; + return new $class(); + } } ?>