/** * Delete a plugin from the system * @param plugin string */ function deletePlugin($plugin) { $templateMgr =& TemplateManager::getManager(); $this->setupTemplate(true); $templateMgr->assign('path', 'delete'); $templateMgr->assign('deleted', false); $templateMgr->assign('error', false); $templateMgr->assign('pageHierarchy', PluginManagementHandler::setBreadcrumbs(true)); $versionDao =& DAORegistry::getDAO('VersionDAO'); $installedPlugin = $versionDao->getCurrentVersion($plugin); $category = $this->getPluginCategory($plugin); if ($installedPlugin) { $pluginDest = Core::getBaseDir() . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . $category . DIRECTORY_SEPARATOR . $plugin; //make sure plugin type is valid and then delete the files if (in_array($category, PluginRegistry::getCategories())) { FileManager::rmtree($pluginDest); } if (FileManager::fileExists($pluginDest, 'dir')) { $templateMgr->assign('error', true); $templateMgr->assign('message', 'manager.plugins.deleteError'); } else { $versionDao->disableVersion($plugin); $templateMgr->assign('deleted', true); } } else { $templateMgr->assign('error', true); $templateMgr->assign('message', 'manager.plugins.doesNotExist'); } $templateMgr->assign('pageHierarchy', $this->setBreadcrumbs(true, $category)); $templateMgr->display('manager/plugins/managePlugins.tpl'); }