$property; } } public function __construct($dw_auth, $user_nick, $action, $conf) { $this->dw_auth = $dw_auth; $this->user_nick = $user_nick; $this->action = $action; $this->conf = $conf; // $db_path = DOKU_INC . 'data/bez.sqlite'; // //if database not exists // if (!file_exists($db_path)) { // $this->db = new PDO('sqlite:/' . $db_path); // $schema = file_get_contents(DOKU_PLUGIN . 'bez/mdl/schema.sql'); // if ($schema === false) { // throw new Exception('cannot find schema file: '.$schema); // } // $this->db->exec($schema); // } else { // $this->db = new PDO('sqlite:/' . $db_path); // } // $this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); // // //convert NULLS to empty strings // $this->db->setAttribute(PDO::ATTR_ORACLE_NULLS, PDO::NULL_TO_STRING); $this->sqlite = plugin_load('helper', 'sqlite'); if(!$this->sqlite) { throw new \Exception('Couldn\'t load sqlite.'); } if($this->sqlite->getAdapter()->getName() != DOKU_EXT_PDO) { throw new \Exception('Couldn\'t load PDO sqlite.'); } $this->sqlite->getAdapter()->setUseNativeAlter(true); // initialize the database connection if(!$this->sqlite->init('b3p', DOKU_PLUGIN . 'bez/db/')) { throw new \Exception('Couldn\'t init sqlite.'); } $this->db = $this->sqlite->getAdapter()->getDb(); $this->acl = new Acl($this); $this->userFactory = new UserFactory($this); $this->threadFactory = new ThreadFactory($this); $this->labelFactory = new LabelFactory($this); // $this->acl = new BEZ_mdl_Acl($this); // // $this->issues = new BEZ_mdl_Issues($this); // $this->tasks = new BEZ_mdl_Tasks($this); // // $this->users = new BEZ_mdl_Users($this); // // $this->issuetypes = new BEZ_mdl_Issuetypes($this); // // $this->tasktypes = new BEZ_mdl_Tasktypes($this); // // $this->commcauses = new BEZ_mdl_Commcauses($this); // $this->timeline = new BEZ_mdl_Timeline($this); } // public function __destruct() { // //http://stackoverflow.com/questions/18277233/pdo-closing-connection // $this->db = NULL; // } }