1549a0837SAndreas Gohr<?php 2549a0837SAndreas Gohr/** 3549a0837SAndreas Gohr * DokuWiki Plugin struct (Helper Component) 4549a0837SAndreas Gohr * 5549a0837SAndreas Gohr * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html 6549a0837SAndreas Gohr * @author Andreas Gohr, Michael Große <dokuwiki@cosmocode.de> 7549a0837SAndreas Gohr */ 8549a0837SAndreas Gohr 9549a0837SAndreas Gohr// must be run within Dokuwiki 10549a0837SAndreas Gohrif(!defined('DOKU_INC')) die(); 11549a0837SAndreas Gohr 12549a0837SAndreas Gohrclass helper_plugin_struct_db extends DokuWiki_Plugin { 13*083afc55SAndreas Gohr /** @var helper_plugin_sqlite */ 14*083afc55SAndreas Gohr protected $sqlite; 15*083afc55SAndreas Gohr 16*083afc55SAndreas Gohr public function __construct() { 17*083afc55SAndreas Gohr /** @var helper_plugin_sqlite $sqlite */ 18*083afc55SAndreas Gohr $this->sqlite = plugin_load('helper', 'sqlite'); 19*083afc55SAndreas Gohr if(!$this->sqlite) { 20*083afc55SAndreas Gohr msg('This plugin requires the sqlite plugin. Please install it', -1); 21*083afc55SAndreas Gohr return; 22*083afc55SAndreas Gohr 23*083afc55SAndreas Gohr //FIXME check that it is SQLite3 we won't support 2 24*083afc55SAndreas Gohr } 25*083afc55SAndreas Gohr 26*083afc55SAndreas Gohr // initialize the database connection 27*083afc55SAndreas Gohr if(!$this->sqlite->init('struct', DOKU_PLUGIN . 'struct/db/')) { 28*083afc55SAndreas Gohr return; 29*083afc55SAndreas Gohr } 30*083afc55SAndreas Gohr } 31549a0837SAndreas Gohr 32549a0837SAndreas Gohr /** 33*083afc55SAndreas Gohr * @return helper_plugin_sqlite|null 34549a0837SAndreas Gohr */ 35*083afc55SAndreas Gohr public function getDB() { 36*083afc55SAndreas Gohr return $this->sqlite; 37549a0837SAndreas Gohr } 38549a0837SAndreas Gohr 39549a0837SAndreas Gohr} 40549a0837SAndreas Gohr 41549a0837SAndreas Gohr// vim:ts=4:sw=4:et: 42