public function preflight($type, $parent) { $parent = $parent->getParent(); $manifest = $parent->getManifest(); // Prevent installation if requirements are not met. if (!$this->checkRequirements($manifest->version)) { return false; } $adminPath = $parent->getPath('extension_administrator'); $sitePath = $parent->getPath('extension_site'); if (is_file($adminPath . '/admin.kunena.php')) { // Kunena 2.0 or older release found, clean up the directories. static $ignoreAdmin = array('index.html', 'kunena.xml', 'archive'); if (is_file($adminPath . '/install.script.php')) { // Kunena 1.7 or older release.. $ignoreAdmin[] = 'install.script.php'; $ignoreAdmin[] = 'admin.kunena.php'; } static $ignoreSite = array('index.html', 'kunena.php', 'router.php', 'template', 'COPYRIGHT.php', 'CHANGELOG.php'); $this->deleteFolder($adminPath, $ignoreAdmin); $this->deleteFolder($sitePath, $ignoreSite); $this->deleteFolder($sitePath . '/template/blue_eagle', array('params.ini')); // TODO: delete also en-GB files! } // Prepare installation. $model = "{$adminPath}/install/model.php"; if (file_exists($model)) { require_once $model; $installer = new KunenaModelInstall(); $installer->install(); } return true; }
function com_uninstall() { if (version_compare(JVERSION, '1.6', '>')) { return; } require_once JPATH_ADMINISTRATOR . '/components/com_kunena/install/model.php'; $installer = new KunenaModelInstall(); $installer->uninstall(); }
function uninstall($parent) { require_once JPATH_ADMINISTRATOR . '/components/com_kunena/api.php'; $lang = JFactory::getLanguage(); $lang->load('com_kunena.install',JPATH_ADMINISTRATOR); require_once(KPATH_ADMIN . '/install/model.php'); $installer = new KunenaModelInstall(); $installer->uninstallPlugin('system', 'kunena'); $installer->deleteMenu(); }
public function uninstall($parent) { $adminpath = $parent->getParent()->getPath('extension_administrator'); $model = "{$adminpath}/install/model.php"; if (file_exists($model)) { require_once $model; $installer = new KunenaModelInstall(); $installer->uninstall(); } return true; }
public function __construct($config = array()) { parent::__construct($config); $app = JFactory::getApplication (); $lang = JFactory::getLanguage(); // Start by loading English strings and override them by current locale $lang->load('com_kunena.install',JPATH_ADMINISTRATOR, 'en-GB'); $lang->load('com_kunena.install',JPATH_ADMINISTRATOR, null, true); require_once(KPATH_ADMIN . '/install/model.php'); $installer = new KunenaModelInstall(); $installer->deleteMenu(); $installer->createMenu(); $app->enqueueMessage ( JText::_('COM_KUNENA_MENU_CREATED') ); $this->redirectBack (); }
public function trashmenu() { require_once KPATH_ADMIN . '/install/model.php'; $installer = new KunenaModelInstall(); $installer->deleteMenu(); $installer->createMenu(); $this->app->enqueueMessage(JText::_('COM_KUNENA_MENU_CREATED')); $this->setRedirect(KunenaRoute::_($this->baseurl, false)); }
/** * Migrate custom information. * * This function gets called after all folders and tables have been copied. * * If you want to split this task into smaller chunks, * please store your custom state variables into $this->state and return false. * Returning false will force jUpgrade to call this function again, * which allows you to continue import by reading $this->state before continuing. * * @return boolean Ready (true/false) * @since 1.6.4 * @throws Exception */ protected function migrateExtensionCustom() { require_once $this->api; // Need to initialize application jimport('joomla.environment.uri'); $app = JFactory::getApplication('administrator'); // Get component object $component = JTable::getInstance('extension', 'JTable', array('dbo' => $this->db_new)); $component->load(array('type' => 'component', 'element' => $this->name)); // First fix all broken menu items $query = "UPDATE #__menu SET component_id={$this->db_new->quote($component->extension_id)} WHERE type = 'component' AND link LIKE '%option={$this->name}%'"; $this->db_new->setQuery($query); $this->db_new->query(); $menumap = $this->getMapList('menus'); // Get all menu items from the component (JMenu style) $query = $this->db_new->getQuery(true); $query->select('*'); $query->from('#__menu'); $query->where("component_id = {$component->extension_id}"); $query->where('client_id = 0'); $query->order('lft'); $this->db_new->setQuery($query); $menuitems = $this->db_new->loadObjectList('id'); foreach ($menuitems as &$menuitem) { // Get parent information. $parent_tree = array(); if (isset($menuitems[$menuitem->parent_id])) { $parent_tree = $menuitems[$menuitem->parent_id]->tree; } // Create tree. $parent_tree[] = $menuitem->id; $menuitem->tree = $parent_tree; // Create the query array. $url = str_replace('index.php?', '', $menuitem->link); $url = str_replace('&', '&', $url); parse_str($url, $menuitem->query); } // Update menu items foreach ($menuitems as $menuitem) { if (!isset($menuitem->query['view'])) { continue; } $update = false; switch ($menuitem->query['view']) { case 'entrypage': // Update default menu item if (!empty($menuitem->query['defaultmenu'])) { $menuitem->query['defaultmenu'] = $menumap[$menuitem->query['defaultmenu']]->new; $update = true; } break; } if ($update) { // Update menuitem link $query_string = array(); foreach ($menuitem->query as $k => $v) { $query_string[] = $k . '=' . $v; } $menuitem->link = 'index.php?' . implode('&', $query_string); // Save menu object $menu = JTable::getInstance('menu', 'JTable', array('dbo' => $this->db_new)); $menu->bind(get_object_vars($menuitem), array('tree', 'query')); $success = $menu->check(); if ($success) { $success = $menu->store(); } if (!$success) { echo "ERROR"; } } } // Delete old manifest file jimport('joomla.filesystem.file'); if (file_exists(JPATH_ADMINISTRATOR . '/components/com_kunena/kunena.j16.xml')) { JFile::delete(JPATH_ADMINISTRATOR . '/components/com_kunena/kunena.xml'); JFile::move(JPATH_ADMINISTRATOR . '/components/com_kunena/kunena.j16.xml', JPATH_ADMINISTRATOR . '/components/com_kunena/kunena.xml'); } jimport('joomla.plugin.helper'); // Mark Kunena as discovered and install it $component->client_id = 1; $component->state = -1; $component->store(); jimport('joomla.installer.installer'); $installer = JInstaller::getInstance(); $installer->discover_install($component->extension_id); // Start Kunena installer require_once dirname(__FILE__) . '/model.php'; $kunena = new KunenaModelInstall(); // Install system plugin $kunena->installSystemPlugin(); // Install English language $kunena->installLanguage('en-GB', 'English'); return true; }
case "uninstallKTemplate": uninstallKTemplate(); break; //########################################### // END TEMPLATE MANAGER //########################################### //########################################### // END TEMPLATE MANAGER //########################################### case "createmenu": $lang = JFactory::getLanguage(); // Start by loading English strings and override them by current locale $lang->load('com_kunena.install', JPATH_ADMINISTRATOR, 'en-GB'); $lang->load('com_kunena.install', JPATH_ADMINISTRATOR); require_once KPATH_ADMIN . '/install/model.php'; $installer = new KunenaModelInstall(); $installer->deleteMenu(); $installer->createMenu(); $kunena_app->enqueueMessage(JText::_('COM_KUNENA_MENU_CREATED')); // No break! Need to display the control panel // No break! Need to display the control panel case 'cpanel': default: html_Kunena::controlPanel(); break; } $kn_version_warning = $kn_version->getVersionWarning('COM_KUNENA_VERSION_INSTALLED'); if (!empty($kn_version_warning)) { $kunena_app->enqueueMessage($kn_version_warning, 'notice'); } if (!$kn_version->checkVersion()) {