<?php rex_sql_util::importDump($this->getPath('_install.sql')); /** * yform * @author jan.kristinus[at]redaxo[dot]org Jan Kristinus * @author <a href="http://www.yakamara.de">www.yakamara.de</a> */ $sql = rex_sql::factory(); $sql->setQuery('CREATE TABLE IF NOT EXISTS `' . rex::getTablePrefix() . 'yform_table` ( `id` int(11) NOT NULL AUTO_INCREMENT, `status` tinyint(1) NOT NULL, `table_name` varchar(100) NOT NULL, `name` varchar(100) NOT NULL, `description` text NOT NULL, `list_amount` tinyint(3) unsigned NOT NULL DEFAULT 50, `list_sortfield` VARCHAR(255) NOT NULL DEFAULT "id", `list_sortorder` ENUM("ASC","DESC") NOT NULL DEFAULT "ASC", `prio` int(11) NOT NULL, `search` tinyint(1) NOT NULL, `hidden` tinyint(1) NOT NULL, `export` tinyint(1) NOT NULL, `import` tinyint(1) NOT NULL, PRIMARY KEY (`id`), UNIQUE(`table_name`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8;'); $sql->setQuery('CREATE TABLE IF NOT EXISTS `' . rex::getTablePrefix() . 'yform_field` ( `id` int(11) NOT NULL AUTO_INCREMENT, `table_name` varchar(100) NOT NULL, `prio` int(11) NOT NULL, `type_id` varchar(100) NOT NULL,
/** * Uninstalls a package. * * @param bool $installDump When TRUE, the sql dump will be importet * * @throws rex_functional_exception * * @return bool TRUE on success, FALSE on error */ public function uninstall($installDump = true) { $isActivated = $this->package->isAvailable(); if ($isActivated && !$this->deactivate()) { return false; } try { $this->package->setProperty('install', false); // include uninstall.php if (is_readable($this->package->getPath(rex_package::FILE_UNINSTALL))) { if (!$isActivated) { rex_i18n::addDirectory($this->package->getPath('lang')); } $this->package->includeFile(rex_package::FILE_UNINSTALL); if (($instmsg = $this->package->getProperty('installmsg', '')) != '') { throw new rex_functional_exception($instmsg); } if ($this->package->isInstalled()) { throw new rex_functional_exception($this->i18n('no_reason')); } } // import uninstall.sql $uninstallSql = $this->package->getPath(rex_package::FILE_UNINSTALL_SQL); if ($installDump === true && is_readable($uninstallSql)) { rex_sql_util::importDump($uninstallSql); } // delete assets $assets = $this->package->getAssetsPath(); if (is_dir($assets) && !rex_dir::delete($assets)) { throw new rex_functional_exception($this->i18n('install_cant_delete_files')); } rex_config::removeNamespace($this->package->getPackageId()); $this->saveConfig(); $this->message = $this->i18n('uninstalled', $this->package->getName()); return true; } catch (rex_functional_exception $e) { $this->message = $e->getMessage(); } catch (rex_sql_exception $e) { $this->message = 'SQL error: ' . $e->getMessage(); } $this->package->setProperty('install', true); if ($isActivated) { $this->package->setProperty('status', true); } $this->saveConfig(); $this->message = $this->i18n('no_uninstall', $this->package->getName()) . '<br />' . $this->message; return false; }