public function install(array $options = array()) { $toret = false; $this->error_msg = false; if ($this->checkConnection()) { $drop_table = array_key_exists('drop_table', $options) ? $options['drop_table'] : false; $query = $this->getInstallSQL(); if ($query) { if ($drop_table) { $table = $this->getSource(); $drop_query = new CustomQuery('DROP TABLE IF EXISTS ' . Query::getTable($this) . '', array('connection' => $this->db)); $drop_query->execute(); Backend::addNotice('Dropping table ' . $table); if (!empty($drop_query->error_msg)) { $this->error_msg = $drop_query->error_msg; } } $query = new CustomQuery($query, array('connection' => $this->db)); $toret = $query->execute(); if (!empty($query->error_msg)) { $this->error_msg = $query->error_msg; } } else { if (class_exists('BackendError', false)) { BackendError::add(get_class($this) . ': No Install SQL', 'install'); } $this->error_msg = 'No Install SQL for ' . class_name($this); } } else { if (class_exists('BackendError', false)) { BackendError::add(get_class($this) . ': DB Connection Error', 'install'); } $this->error_msg = 'DB Connection error'; } return $toret; }