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