summaryrefslogtreecommitdiff
path: root/src/phorkie/Database.php
blob: 1f214e8a6622ede5d64b08373951323e01e3138f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
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()
    {
        $class = $this->prefix . '_Search';
        return new $class();
    }

    public function getIndexer()
    {
        $class = $this->prefix . '_Indexer';
        return new $class();
    }

    public function getSetup()
    {
        $class = $this->prefix . '_Setup';
        return new $class();
    }
}

?>