public static function delete($ids) { if (!is_array($ids)) { $ids = array($ids); } $db = DevblocksPlatform::getDatabaseService(); foreach ($ids as $id) { @($tool = DAO_CommunityTool::get($id)); if (empty($tool)) { continue; } /** * [TODO] [JAS] Deleting a community tool needs to run a hook first so the * tool has a chance to clean up its own DB tables abstractly. * * e.g. Knowledgebase instances which store data outside the tool property table * * After this is done, a future DB patch for those plugins should clean up any * orphaned data. */ $sql = sprintf("DELETE QUICK FROM community_tool WHERE id = %d", $id); $db->Execute($sql) or die(__CLASS__ . '(' . __LINE__ . ')' . ':' . $db->ErrorMsg()); /* @var $rs ADORecordSet */ $sql = sprintf("DELETE QUICK FROM community_tool_property WHERE tool_code = '%s'", $tool->code); $db->Execute($sql) or die(__CLASS__ . '(' . __LINE__ . ')' . ':' . $db->ErrorMsg()); /* @var $rs ADORecordSet */ } }
function showTabInstallationAction() { @($tool_id = DevblocksPlatform::importGPC($_REQUEST['id'], 'integer', 0)); $tpl = DevblocksPlatform::getTemplateService(); $tpl->assign('path', $this->_TPL_PATH); if (null != ($tool = DAO_CommunityTool::get($tool_id))) { $tpl->assign('tool', $tool); } // Install $url_writer = DevblocksPlatform::getUrlService(); $url = $url_writer->write('c=portal&a=' . $tool->code, true); $url_parts = parse_url($url); $host = $url_parts['host']; @($port = $_SERVER['SERVER_PORT']); $base = substr(DEVBLOCKS_WEBPATH, 0, -1); // consume trailing $path = substr($url_parts['path'], strlen(DEVBLOCKS_WEBPATH) - 1); // consume trailing slash @($parts = explode('/', $path)); if ($parts[1] == 'index.php') { // 0 is null from /part1/part2 paths. unset($parts[1]); } $path = implode('/', $parts); $tpl->assign('host', $host); $tpl->assign('is_ssl', $url_writer->isSSL() ? 1 : 0); $tpl->assign('port', $port); $tpl->assign('base', $base); $tpl->assign('path', $path); $tpl->display('file:' . $this->_TPL_PATH . 'community/display/tabs/installation/index.tpl'); }