xref: /plugin/struct/helper/db.php (revision 083afc55c907a52e46afc662d6f808a98112c779)
1<?php
2/**
3 * DokuWiki Plugin struct (Helper Component)
4 *
5 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
6 * @author  Andreas Gohr, Michael Große <dokuwiki@cosmocode.de>
7 */
8
9// must be run within Dokuwiki
10if(!defined('DOKU_INC')) die();
11
12class helper_plugin_struct_db extends DokuWiki_Plugin {
13    /** @var helper_plugin_sqlite */
14    protected $sqlite;
15
16    public function __construct() {
17        /** @var helper_plugin_sqlite $sqlite */
18        $this->sqlite = plugin_load('helper', 'sqlite');
19        if(!$this->sqlite) {
20            msg('This plugin requires the sqlite plugin. Please install it', -1);
21            return;
22
23            //FIXME check that it is SQLite3 we won't support 2
24        }
25
26        // initialize the database connection
27        if(!$this->sqlite->init('struct', DOKU_PLUGIN . 'struct/db/')) {
28            return;
29        }
30    }
31
32    /**
33     * @return helper_plugin_sqlite|null
34     */
35    public function getDB() {
36        return $this->sqlite;
37    }
38
39}
40
41// vim:ts=4:sw=4:et:
42