public function uninstall() { // check uninstall.php $file = $this->getAppConfigPath('uninstall'); if (file_exists($file)) { include $file; } $file_db = $this->getAppPath('lib/config/db.php'); if (file_exists($file_db)) { $schema = (include $file_db); $model = new waModel(); foreach ($schema as $table => $fields) { $sql = "DROP TABLE IF EXISTS " . $table; $model->exec($sql); } } // Remove all app settings $app_settings_model = new waAppSettingsModel(); $app_settings_model->del($this->application); $contact_settings_model = new waContactSettingsModel(); $contact_settings_model->deleteByField('app_id', $this->application); // Remove all rights to app $contact_rights_model = new waContactRightsModel(); $contact_rights_model->deleteByField('app_id', $this->application); // Remove logs $log_model = new waLogModel(); $log_model->deleteByField('app_id', $this->application); // Remove cache waFiles::delete($this->getPath('cache') . '/apps/' . $this->application); }