aboutsummaryrefslogtreecommitdiff
path: root/src/phorkie/Database.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/phorkie/Database.php')
-rw-r--r--src/phorkie/Database.php17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/phorkie/Database.php b/src/phorkie/Database.php
index 9854e7c..786cfe0 100644
--- a/src/phorkie/Database.php
+++ b/src/phorkie/Database.php
@@ -3,19 +3,30 @@ namespace phorkie;
class Database
{
+ public $prefix = '\phorkie\Database_Adapter_Null';
+
+ public function __construct()
+ {
+ if ($GLOBALS['phorkie']['cfg']['elasticsearch'] != '') {
+ $this->prefix = '\phorkie\Database_Adapter_Elasticsearch';
+ }
+ }
public function getSearch()
{
- return new Database_Adapter_Elasticsearch_Search();
+ $class = $this->prefix . '_Search';
+ return new $class();
}
public function getIndexer()
{
- return new Database_Adapter_Elasticsearch_Indexer();
+ $class = $this->prefix . '_Indexer';
+ return new $class();
}
public function getSetup()
{
- return new Database_Adapter_Elasticsearch_Setup();
+ $class = $this->prefix . '_Setup';
+ return new $class();
}
}