X-Git-Url: https://git.cweiske.de/phorkie.git/blobdiff_plain/3c83676016bce1727f0046f4aad7865be8a71fd4..6bde4b82ec04ee5a1622220663bcacca2ec301d6:/src/phorkie/Database.php diff --git a/src/phorkie/Database.php b/src/phorkie/Database.php index e9a75a1..1f214e8 100644 --- a/src/phorkie/Database.php +++ b/src/phorkie/Database.php @@ -3,19 +3,32 @@ 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() { - return new Database_Setup_Elasticsearch(); + $class = $this->prefix . '_Setup'; + return new $class(); } }