xref: /plugin/sqlite/helper/db.php (revision 3a56750b42e05745f84fd97217f7133805e622eb)
1<?php
2
3/**
4 * DokuWiki Plugin sqlite (Helper Component)
5 *
6 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
7 * @author  Andreas Gohr, Michael Große <dokuwiki@cosmocode.de>
8 */
9
10
11class helper_plugin_sqlite_db extends DokuWiki_Plugin
12{
13    /** @var helper_plugin_sqlite */
14    protected $sqlite;
15
16    /**
17     * helper_plugin_sqlite_db constructor.
18     */
19    public function __construct()
20    {
21        $this->init();
22    }
23
24    /**
25     * Initialize the database
26     *
27     */
28    protected function init()
29    {
30        /** @var helper_plugin_sqlite $sqlite */
31        $this->sqlite = plugin_load('helper', 'sqlite');
32
33        // initialize the database connection
34        if (!$this->sqlite->init('sqlite', DOKU_PLUGIN . 'sqlite/db/')) {
35            $this->sqlite = null;
36        }
37    }
38
39    /**
40     * @return helper_plugin_sqlite|null
41     */
42    public function getDB()
43    {
44        return $this->sqlite;
45    }
46}
47
48// vim:ts=4:sw=4:et:
49