public function do_execute() { /* Prepare variables */ try { $project_id = $this->getProvidedArgument('projectid'); $project_row = TBGProjectsTable::getTable()->getById($project_id, false); TBGContext::setScope(new TBGScope($project_row[TBGProjectsTable::SCOPE])); $project = new TBGProject($project_id, $project_row); } catch (Exception $e) { throw $e; $this->cliEcho("The project with the ID " . $this->getProvidedArgument('projectid') . " does not exist\n", 'red', 'bold'); exit; } $author = $this->getProvidedArgument('author'); $new_rev = $this->getProvidedArgument('revno'); $commit_msg = $this->getProvidedArgument('log'); $changed = $this->getProvidedArgument('changed'); $old_rev = $this->getProvidedArgument('oldrev', null); $date = $this->getProvidedArgument('date', null); $branch = $this->getProvidedArgument('branch', null); if (TBGSettings::get('access_method_' . $project->getKey()) == TBGVCSIntegration::ACCESS_HTTP) { $this->cliEcho("This project uses the HTTP access method, and so access via the CLI has been disabled\n", 'red', 'bold'); exit; } if ($old_rev === null && !is_integer($new_rev)) { $this->cliEcho("Error: if only the new revision is specified, it must be a number so that old revision can be calculated from it (by substracting 1 from new revision number)."); } else { if ($old_rev === null) { $old_rev = $new_rev - 1; } } $output = TBGVCSIntegration::processCommit($project, $commit_msg, $old_rev, $new_rev, $date, $changed, $author, $branch); $this->cliEcho($output); }
public function getByID($id) { $crit = $this->getCriteria(); $crit->addWhere(self::SCOPE, TBGContext::getScope()->getID()); $row = $this->doSelectById($id, $crit, false); return $row; }
public function do_execute() { $this->cliEcho("Importing articles ... \n", 'white', 'bold'); TBGEvent::listen('publish', 'fixture_article_loaded', array($this, 'listenPublishFixtureArticleCreated')); $overwrite = (bool) ($this->getProvidedArgument('overwrite', 'no') == 'yes'); TBGPublish::getModule()->loadFixturesArticles(TBGContext::getScope()->getID(), $overwrite); }
public function countWorkflows($scope = null) { $scope = $scope === null ? TBGContext::getScope()->getID() : $scope; $crit = $this->getCriteria(); $crit->addWhere(self::SCOPE, $scope); return $this->doCount($crit); }
public function getByTransitionID($transition_id) { $crit = $this->getCriteria(); $crit->addWhere(self::SCOPE, TBGContext::getScope()->getID()); $crit->addWhere(self::TRANSITION_ID, $transition_id); return $this->doSelect($crit); }
public function getAll() { $crit = $this->getCriteria(); $crit->addWhere(self::SCOPE, TBGContext::getScope()->getID()); $crit->addOrderBy(self::ID, Criteria::SORT_ASC); return $this->select($crit); }
public function quickfind($client_name) { $crit = $this->getCriteria(); $crit->addWhere(self::NAME, "%{$client_name}%", Criteria::DB_LIKE); $crit->addWhere(self::SCOPE, TBGContext::getScope()->getID()); return $this->select($crit); }
public function deleteProcessedMessages($ids) { $crit = $this->getCriteria(); $crit->addWhere(self::ID, (array) $ids, B2DBCriteria::DB_IN); $crit->addWhere(self::SCOPE, TBGContext::getScope()->getID()); $res = $this->doDelete($crit); }
public function doesGroupNameExist($group_name) { $crit = $this->getCriteria(); $crit->addWhere(self::NAME, $group_name); $crit->addWhere(self::SCOPE, TBGContext::getScope()->getID()); return (bool) $this->doCount($crit); }
public function do_execute() { $this->cliEcho('Authenticating with server: '); $this->cliEcho($this->getProvidedArgument('server_url'), 'white', 'bold'); $this->cliEcho("\n"); $path = THEBUGGENIE_CONFIG_PATH; try { file_put_contents($path . '.remote_server', $this->getProvidedArgument('server_url')); } catch (Exception $e) { $path = getenv('HOME') . DS; file_put_contents($path . '.remote_server', $this->getProvidedArgument('server_url')); } $this->cliEcho('Authenticating as user: '******'username', TBGContext::getCurrentCLIusername()); $this->cliEcho($username, 'white', 'bold'); $this->cliEcho("\n"); file_put_contents($path . '.remote_username', $username); $this->_current_remote_server = file_get_contents($path . '.remote_server'); $this->cliEcho("\n"); $this->cliEcho('You need to authenticate using an application-specific password.'); $this->cliEcho("\n"); $this->cliEcho("Create an application password from your account's 'Security' tab."); $this->cliEcho("\n"); $this->cliEcho("Enter the application-specific password: "******"Authentication successful!\n", 'white', 'bold'); }
public function countTeams() { $crit = $this->getCriteria(); $crit->addWhere(self::SCOPE, TBGContext::getScope()->getID()); $crit->addWhere(self::ONDEMAND, false); return $this->doCount($crit); }
public function deleteBySearchID($saved_search_id) { $crit = $this->getCriteria(); $crit->addWhere(self::SCOPE, TBGContext::getScope()->getID()); $crit->addWhere(self::SEARCH_ID, $saved_search_id); $this->doDelete($crit); }
public function removeEditionComponent($edition_id, $component_id) { $crit = $this->getCriteria(); $crit->addWhere(self::EDITION, $edition_id); $crit->addWhere(self::COMPONENT, $component_id); $crit->addWhere(self::SCOPE, TBGContext::getScope()->getID()); $res = $this->doDelete($crit); }
public function clearDefaultsByEditionID($edition_id) { $crit = $this->getCriteria(); $crit->addUpdate(self::IS_DEFAULT, false); $crit->addWhere(self::SCOPE, TBGContext::getScope()->getID()); $crit->addWhere(self::EDITION, $edition_id); $res = $this->doUpdate($crit); }
public function addStarredArticle($user_id, $article_id) { $crit = $this->getCriteria(); $crit->addInsert(self::ARTICLE, $article_id); $crit->addInsert(self::UID, $user_id); $crit->addInsert(self::SCOPE, TBGContext::getScope()->getID()); $this->doInsert($crit); }
public function componentLeftmenu() { $this->show_article_options = (bool) ($this->article instanceof TBGWikiArticle); $this->links_target_id = TBGContext::isProjectContext() ? TBGContext::getCurrentProject()->getID() : 0; $this->links = TBGPublish::getModule()->getMenuItems($this->links_target_id); $this->user_drafts = TBGPublish::getModule()->getUserDrafts(); $this->whatlinkshere = $this->article instanceof TBGWikiArticle ? $this->article->getLinkingArticles() : null; }
public function removeFriendByUserID($user_id, $friend_id) { $crit = $this->getCriteria(); $crit->addWhere(self::UID, $user_id); $crit->addWhere(self::BID, $friend_id); $crit->addWhere(self::SCOPE, TBGContext::getScope()->getID()); $this->doDelete($crit); }
public function addStarredIssue($user_id, $issue_id) { $crit = $this->getCriteria(); $crit->addInsert(self::ISSUE, $issue_id); $crit->addInsert(self::UID, $user_id); $crit->addInsert(self::SCOPE, TBGContext::getScope()->getID()); $this->doInsert($crit); }
public function deleteByIssuetypeID($issuetype_id) { $crit = $this->getCriteria(); $crit->addWhere(self::ISSUETYPE_ID, $issuetype_id); $crit->addWhere(self::SCOPE, TBGContext::getScope()->getID()); $this->doDelete($crit); return true; }
public function getAll($scope = null) { $scope = $scope === null ? TBGContext::getScope()->getID() : $scope; $crit = $this->getCriteria(); $crit->addWhere(self::SCOPE, $scope); $res = $this->doSelect($crit); return $res; }
/** * Return a custom data type option by value and key * * @param string|integer $value * @param string $key * * @return TBGCustomDatatypeOption */ public static function getByValueAndKey($value, $key) { $row = B2DB::getTable('TBGCustomFieldOptionsTable')->getByValueAndKey($value, $key); if ($row) { return TBGContext::factory()->TBGCustomDatatypeOption($row->get(TBGCustomFieldOptionsTable::ID), $row); } return null; }
public function getLinkingArticles($linked_article_name) { $crit = $this->getCriteria(); $crit->addWhere(self::LINK_ARTICLE_NAME, $linked_article_name); $crit->addWhere(self::SCOPE, TBGContext::getScope()->getID()); $res = $this->doSelect($crit); return $res; }
public function disableModuleByName($module_name) { $crit = $this->getCriteria(); $crit->addUpdate(self::ENABLED, 0); $crit->addWhere(self::MODULE_NAME, $module_name); $crit->addWhere(self::SCOPE, TBGContext::getScope()->getID()); return $this->doUpdate($crit); }
/** * Create a new status * * @param string $name The status description * @param string $itemdata[optional] The color if any (default FFF) * * @return TBGStatus */ public static function createNew($name, $itemdata = null) { $itemdata = $itemdata === null || trim($itemdata) == '' ? '#FFF' : $itemdata; if (substr($itemdata, 0, 1) != '#') { $itemdata = '#' . $itemdata; } $res = parent::_createNew($name, self::STATUS, $itemdata); return TBGContext::factory()->TBGStatus($res->getInsertID()); }
public function addByProjectIDAndMilestoneID($project_id, $milestone_id) { $crit = $this->getCriteria(); $crit->addInsert(self::PROJECT_ID, $project_id); $crit->addInsert(self::MILESTONE_ID, $milestone_id); $crit->addInsert(self::SCOPE, TBGContext::getScope()->getID()); $res = $this->doInsert($crit); return true; }
/** * @covers TBGContext::isInstallmode * @covers TBGContext::checkInstallMode */ public function testInstallMode() { TBGContext::checkInstallMode(); if (file_exists(THEBUGGENIE_PATH . 'installed')) { $this->assertFalse(TBGContext::isInstallmode()); } else { $this->assertTrue(TBGContext::isInstallmode()); } }
public function addChildIssue($issue_id, $child_id) { $crit = $this->getCriteria(); $crit->addInsert(self::PARENT_ID, $issue_id); $crit->addInsert(self::CHILD_ID, $child_id); $crit->addInsert(self::SCOPE, TBGContext::getScope()->getID()); $res = $this->doInsert($crit); return $res; }
public function getByIDs($ids) { if (empty($ids)) { return array(); } $crit = $this->getCriteria(); $crit->addWhere(self::SCOPE, TBGContext::getScope()->getID()); $crit->addWhere(self::ID, $ids, Criteria::DB_IN); return $this->select($crit); }
public function getSubCategories($category_name) { $crit = $this->getCriteria(); $crit->addWhere(self::CATEGORY_NAME, $category_name); $crit->addWhere(self::ARTICLE_IS_CATEGORY, true); $crit->addWhere(self::SCOPE, TBGContext::getScope()->getID()); $crit->addOrderBy(self::CATEGORY_NAME, B2DBCriteria::SORT_ASC); $res = $this->doSelect($crit); return $res; }
public function saveOptionOrder($options, $customfield_id) { foreach ($options as $key => $option_id) { $crit = $this->getCriteria(); $crit->addUpdate(self::SORT_ORDER, $key + 1); $crit->addWhere(self::CUSTOMFIELD_ID, $customfield_id); $crit->addWhere(self::SCOPE, TBGContext::getScope()->getID()); $this->doUpdateById($crit, $option_id); } }