private function executeManiphestFieldChecks() { $maniphest_appclass = 'PhabricatorManiphestApplication'; if (!PhabricatorApplication::isClassInstalled($maniphest_appclass)) { return; } $capabilities = array(ManiphestEditAssignCapability::CAPABILITY, ManiphestEditPoliciesCapability::CAPABILITY, ManiphestEditPriorityCapability::CAPABILITY, ManiphestEditProjectsCapability::CAPABILITY, ManiphestEditStatusCapability::CAPABILITY); // Check for any of these capabilities set to anything other than // "All Users". $any_set = false; $app = new PhabricatorManiphestApplication(); foreach ($capabilities as $capability) { $setting = $app->getPolicy($capability); if ($setting != PhabricatorPolicies::POLICY_USER) { $any_set = true; break; } } if (!$any_set) { return; } $issue_summary = pht('Maniphest is currently configured with deprecated policy settings ' . 'which will be removed in a future version of Phabricator.'); $message = pht('Some policy settings in Maniphest are now deprecated and will be ' . 'removed in a future version of Phabricator. You are currently using ' . 'at least one of these settings.' . "\n\n" . 'The deprecated settings are "Can Assign Tasks", ' . '"Can Edit Task Policies", "Can Prioritize Tasks", ' . '"Can Edit Task Projects", and "Can Edit Task Status". You can ' . 'find these settings in Applications, or follow the link below.' . "\n\n" . 'You can find discussion of this change (including rationale and ' . 'recommendations on how to configure similar features) in the upstream, ' . 'at the link below.' . "\n\n" . 'To resolve this issue, set all of these policies to "All Users" after ' . 'making any necessary form customization changes.'); $more_href = 'https://secure.phabricator.com/T10003'; $edit_href = '/applications/view/PhabricatorManiphestApplication/'; $issue = $this->newIssue('maniphest.T10003-per-field-policies')->setShortName(pht('Deprecated Policies'))->setName(pht('Deprecated Maniphest Field Policies'))->setSummary($issue_summary)->setMessage($message)->addLink($more_href, pht('Learn More: Upstream Discussion'))->addLink($edit_href, pht('Edit These Settings')); }
public static function loadForRevision($revision) { $app_legalpad = 'PhabricatorLegalpadApplication'; if (!PhabricatorApplication::isClassInstalled($app_legalpad)) { return array(); } if (!$revision->getPHID()) { return array(); } $phids = PhabricatorEdgeQuery::loadDestinationPHIDs($revision->getPHID(), LegalpadObjectNeedsSignatureEdgeType::EDGECONST); if ($phids) { // NOTE: We're bypassing permissions to pull these. We have to expose // some information about signature status in order to implement this // field meaningfully (otherwise, we could not tell reviewers that they // can't accept the revision yet), but that's OK because the only way to // require signatures is with a "Global" Herald rule, which requires a // high level of access. $signatures = id(new LegalpadDocumentSignatureQuery())->setViewer(PhabricatorUser::getOmnipotentUser())->withDocumentPHIDs($phids)->withSignerPHIDs(array($revision->getAuthorPHID()))->execute(); $signatures = mpull($signatures, null, 'getDocumentPHID'); $phids = array_fuse($phids); foreach ($phids as $phid) { $phids[$phid] = isset($signatures[$phid]); } } return $phids; }
public function publishNotifications() { $cursor = $this->getCursor(); $now = PhabricatorTime::getNow(); if ($cursor > $now) { return; } $calendar_class = 'PhabricatorCalendarApplication'; if (!PhabricatorApplication::isClassInstalled($calendar_class)) { return; } try { $lock = PhabricatorGlobalLock::newLock('calendar.notify')->lock(5); } catch (PhutilLockException $ex) { return; } $caught = null; try { $this->sendNotifications(); } catch (Exception $ex) { $caught = $ex; } $lock->unlock(); // Wait a little while before checking for new notifications to send. $this->setCursor($cursor + phutil_units('1 minute in seconds')); if ($caught) { throw $caught; } }
public function isEnabled() { $servers = PhabricatorNotificationServerRef::getEnabledAdminServers(); if (!$servers) { return false; } return PhabricatorApplication::isClassInstalled('PhabricatorNotificationsApplication'); }
protected function execute(ConduitAPIRequest $request) { $authentication = array('token', 'asymmetric', 'session', 'sessionless'); $oauth_app = 'PhabricatorOAuthServerApplication'; if (PhabricatorApplication::isClassInstalled($oauth_app)) { $authentication[] = 'oauth'; } return array('authentication' => $authentication, 'signatures' => array('consign'), 'input' => array('json', 'urlencoded'), 'output' => array('json', 'human')); }
protected function isPhameActive() { $base_uri = PhabricatorEnv::getEnvConfig('phabricator.base-uri'); if (!strlen($base_uri)) { // Don't activate Phame if we don't have a base URI configured. return false; } $phame_installed = PhabricatorApplication::isClassInstalled('PhabricatorPhameApplication'); if (!$phame_installed) { // Don't activate Phame if the the application is uninstalled. return false; } return true; }
public function newSiteForRequest(AphrontRequest $request) { $host = $request->getHost(); $uri = PhabricatorEnv::getEnvConfig('phurl.short-uri'); if (!strlen($uri)) { return null; } $phurl_installed = PhabricatorApplication::isClassInstalled('PhabricatorPhurlApplication'); if (!$phurl_installed) { return false; } if ($this->isHostMatch($host, array($uri))) { return new PhabricatorShortSite(); } return null; }
protected function buildActionView(DiffusionRequest $drequest) { $viewer = $this->getRequest()->getUser(); $view = id(new PhabricatorActionListView())->setUser($viewer); $history_uri = $drequest->generateURI(array('action' => 'history')); $view->addAction(id(new PhabricatorActionView())->setName(pht('View History'))->setHref($history_uri)->setIcon('fa-list')); $behind_head = $drequest->getSymbolicCommit(); $head_uri = $drequest->generateURI(array('commit' => '', 'action' => 'browse')); $view->addAction(id(new PhabricatorActionView())->setName(pht('Jump to HEAD'))->setHref($head_uri)->setIcon('fa-home')->setDisabled(!$behind_head)); // TODO: Ideally, this should live in Owners and be event-triggered, but // there's no reasonable object for it to react to right now. $owners = 'PhabricatorOwnersApplication'; if (PhabricatorApplication::isClassInstalled($owners)) { $owners_uri = id(new PhutilURI('/owners/view/search/'))->setQueryParams(array('repository' => $drequest->getCallsign(), 'path' => '/' . $drequest->getPath())); $view->addAction(id(new PhabricatorActionView())->setName(pht('Find Owners'))->setHref((string) $owners_uri)->setIcon('fa-users')); } return $view; }
protected function buildPropertyView(DiffusionRequest $drequest, PhabricatorActionListView $actions) { $viewer = $this->getViewer(); $view = id(new PHUIPropertyListView())->setUser($viewer)->setActionList($actions); $stable_commit = $drequest->getStableCommit(); $callsign = $drequest->getRepository()->getCallsign(); $view->addProperty(pht('Commit'), phutil_tag('a', array('href' => $drequest->generateURI(array('action' => 'commit', 'commit' => $stable_commit))), $drequest->getRepository()->formatCommitName($stable_commit))); if ($drequest->getSymbolicType() == 'tag') { $symbolic = $drequest->getSymbolicCommit(); $view->addProperty(pht('Tag'), $symbolic); $tags = $this->callConduitWithDiffusionRequest('diffusion.tagsquery', array('names' => array($symbolic), 'needMessages' => true)); $tags = DiffusionRepositoryTag::newFromConduit($tags); $tags = mpull($tags, null, 'getName'); $tag = idx($tags, $symbolic); if ($tag && strlen($tag->getMessage())) { $view->addSectionHeader(pht('Tag Content')); $view->addTextContent($this->markupText($tag->getMessage())); } } $repository = $drequest->getRepository(); $owners = 'PhabricatorOwnersApplication'; if (PhabricatorApplication::isClassInstalled($owners)) { $package_query = id(new PhabricatorOwnersPackageQuery())->setViewer($viewer)->withControl($repository->getPHID(), array($drequest->getPath())); $package_query->execute(); $packages = $package_query->getControllingPackagesForPath($repository->getPHID(), $drequest->getPath()); if ($packages) { $ownership = id(new PHUIStatusListView())->setUser($viewer); foreach ($packages as $package) { $icon = 'fa-list-alt'; $color = 'grey'; $item = id(new PHUIStatusItemView())->setIcon($icon, $color)->setTarget($viewer->renderHandle($package->getPHID())); $ownership->addItem($item); } } else { $ownership = phutil_tag('em', array(), pht('None')); } $view->addProperty(pht('Packages'), $ownership); } return $view; }
private function buildCurtain(PhabricatorRepositoryCommit $commit, PhabricatorRepository $repository) { $request = $this->getRequest(); $viewer = $this->getViewer(); $curtain = $this->newCurtainView($commit); $can_edit = PhabricatorPolicyFilter::hasCapability($viewer, $commit, PhabricatorPolicyCapability::CAN_EDIT); $identifier = $commit->getCommitIdentifier(); $uri = $repository->getPathURI("commit/{$identifier}/edit/"); $action = id(new PhabricatorActionView())->setName(pht('Edit Commit'))->setHref($uri)->setIcon('fa-pencil')->setDisabled(!$can_edit)->setWorkflow(!$can_edit); $curtain->addAction($action); require_celerity_resource('phabricator-object-selector-css'); require_celerity_resource('javelin-behavior-phabricator-object-selector'); $maniphest = 'PhabricatorManiphestApplication'; if (PhabricatorApplication::isClassInstalled($maniphest)) { $action = id(new PhabricatorActionView())->setName(pht('Edit Maniphest Tasks'))->setIcon('fa-anchor')->setHref('/search/attach/' . $commit->getPHID() . '/TASK/edge/')->setWorkflow(true)->setDisabled(!$can_edit); $curtain->addAction($action); } $action = id(new PhabricatorActionView())->setName(pht('Download Raw Diff'))->setHref($request->getRequestURI()->alter('diff', true))->setIcon('fa-download'); $curtain->addAction($action); return $curtain; }
public function isEnabled() { $almanac_app = 'PhabricatorAlmanacApplication'; return PhabricatorApplication::isClassInstalled($almanac_app); }
public function isEnabled() { $app_class = 'PhabricatorDifferentialApplication'; return PhabricatorApplication::isClassInstalled($app_class); }
protected function expandTransaction(PhabricatorLiskDAO $object, PhabricatorApplicationTransaction $xaction) { $results = parent::expandTransaction($object, $xaction); $actor = $this->getActor(); $actor_phid = $this->getActingAsPHID(); $type_edge = PhabricatorTransactions::TYPE_EDGE; $status_plan = ArcanistDifferentialRevisionStatus::CHANGES_PLANNED; $edge_reviewer = DifferentialRevisionHasReviewerEdgeType::EDGECONST; $edge_ref_task = DifferentialRevisionHasTaskEdgeType::EDGECONST; $is_sticky_accept = PhabricatorEnv::getEnvConfig('differential.sticky-accept'); $downgrade_rejects = false; $downgrade_accepts = false; if ($this->getIsCloseByCommit()) { // Never downgrade reviewers when we're closing a revision after a // commit. } else { switch ($xaction->getTransactionType()) { case DifferentialTransaction::TYPE_UPDATE: $downgrade_rejects = true; if (!$is_sticky_accept) { // If "sticky accept" is disabled, also downgrade the accepts. $downgrade_accepts = true; } break; case DifferentialTransaction::TYPE_ACTION: switch ($xaction->getNewValue()) { case DifferentialAction::ACTION_REQUEST: $downgrade_rejects = true; if (!$is_sticky_accept || $object->getStatus() != $status_plan) { // If the old state isn't "changes planned", downgrade the // accepts. This exception allows an accepted revision to // go through Plan Changes -> Request Review to return to // "accepted" if the author didn't update the revision. $downgrade_accepts = true; } break; } break; } } $new_accept = DifferentialReviewerStatus::STATUS_ACCEPTED; $new_reject = DifferentialReviewerStatus::STATUS_REJECTED; $old_accept = DifferentialReviewerStatus::STATUS_ACCEPTED_OLDER; $old_reject = DifferentialReviewerStatus::STATUS_REJECTED_OLDER; if ($downgrade_rejects || $downgrade_accepts) { // When a revision is updated, change all "reject" to "rejected older // revision". This means we won't immediately push the update back into // "needs review", but outstanding rejects will still block it from // moving to "accepted". // We also do this for "Request Review", even though the diff is not // updated directly. Essentially, this acts like an update which doesn't // actually change the diff text. $edits = array(); foreach ($object->getReviewerStatus() as $reviewer) { if ($downgrade_rejects) { if ($reviewer->getStatus() == $new_reject) { $edits[$reviewer->getReviewerPHID()] = array('data' => array('status' => $old_reject)); } } if ($downgrade_accepts) { if ($reviewer->getStatus() == $new_accept) { $edits[$reviewer->getReviewerPHID()] = array('data' => array('status' => $old_accept)); } } } if ($edits) { $results[] = id(new DifferentialTransaction())->setTransactionType($type_edge)->setMetadataValue('edge:type', $edge_reviewer)->setIgnoreOnNoEffect(true)->setNewValue(array('+' => $edits)); } } switch ($xaction->getTransactionType()) { case DifferentialTransaction::TYPE_UPDATE: if ($this->getIsCloseByCommit()) { // Don't bother with any of this if this update is a side effect of // commit detection. break; } // When a revision is updated and the diff comes from a branch named // "T123" or similar, automatically associate the commit with the // task that the branch names. $maniphest = 'PhabricatorManiphestApplication'; if (PhabricatorApplication::isClassInstalled($maniphest)) { $diff = $this->requireDiff($xaction->getNewValue()); $branch = $diff->getBranch(); // No "$", to allow for branches like T123_demo. $match = null; if (preg_match('/^T(\\d+)/i', $branch, $match)) { $task_id = $match[1]; $tasks = id(new ManiphestTaskQuery())->setViewer($this->getActor())->withIDs(array($task_id))->execute(); if ($tasks) { $task = head($tasks); $task_phid = $task->getPHID(); $results[] = id(new DifferentialTransaction())->setTransactionType($type_edge)->setMetadataValue('edge:type', $edge_ref_task)->setIgnoreOnNoEffect(true)->setNewValue(array('+' => array($task_phid => $task_phid))); } } } break; case PhabricatorTransactions::TYPE_COMMENT: // When a user leaves a comment, upgrade their reviewer status from // "added" to "commented" if they're also a reviewer. We may further // upgrade this based on other actions in the transaction group. $status_added = DifferentialReviewerStatus::STATUS_ADDED; $status_commented = DifferentialReviewerStatus::STATUS_COMMENTED; $data = array('status' => $status_commented); $edits = array(); foreach ($object->getReviewerStatus() as $reviewer) { if ($reviewer->getReviewerPHID() == $actor_phid) { if ($reviewer->getStatus() == $status_added) { $edits[$actor_phid] = array('data' => $data); } } } if ($edits) { $results[] = id(new DifferentialTransaction())->setTransactionType($type_edge)->setMetadataValue('edge:type', $edge_reviewer)->setIgnoreOnNoEffect(true)->setNewValue(array('+' => $edits)); } break; case DifferentialTransaction::TYPE_ACTION: $action_type = $xaction->getNewValue(); switch ($action_type) { case DifferentialAction::ACTION_ACCEPT: case DifferentialAction::ACTION_REJECT: if ($action_type == DifferentialAction::ACTION_ACCEPT) { $data = array('status' => DifferentialReviewerStatus::STATUS_ACCEPTED); } else { $data = array('status' => DifferentialReviewerStatus::STATUS_REJECTED); } $edits = array(); foreach ($object->getReviewerStatus() as $reviewer) { if ($reviewer->hasAuthority($actor)) { $edits[$reviewer->getReviewerPHID()] = array('data' => $data); } } // Also either update or add the actor themselves as a reviewer. $edits[$actor_phid] = array('data' => $data); $results[] = id(new DifferentialTransaction())->setTransactionType($type_edge)->setMetadataValue('edge:type', $edge_reviewer)->setIgnoreOnNoEffect(true)->setNewValue(array('+' => $edits)); break; case DifferentialAction::ACTION_CLAIM: // If the user is commandeering, add the previous owner as a // reviewer and remove the actor. $edits = array('-' => array($actor_phid => $actor_phid)); $owner_phid = $object->getAuthorPHID(); if ($owner_phid) { $reviewer = new DifferentialReviewer($owner_phid, array('status' => DifferentialReviewerStatus::STATUS_ADDED)); $edits['+'] = array($owner_phid => array('data' => $reviewer->getEdgeData())); } // NOTE: We're setting setIsCommandeerSideEffect() on this because // normally you can't add a revision's author as a reviewer, but // this action swaps them after validation executes. $results[] = id(new DifferentialTransaction())->setTransactionType($type_edge)->setMetadataValue('edge:type', $edge_reviewer)->setIgnoreOnNoEffect(true)->setIsCommandeerSideEffect(true)->setNewValue($edits); break; case DifferentialAction::ACTION_RESIGN: // If the user is resigning, add a separate reviewer edit // transaction which removes them as a reviewer. $results[] = id(new DifferentialTransaction())->setTransactionType($type_edge)->setMetadataValue('edge:type', $edge_reviewer)->setIgnoreOnNoEffect(true)->setNewValue(array('-' => array($actor_phid => $actor_phid))); break; } break; } if (!$this->didExpandInlineState) { switch ($xaction->getTransactionType()) { case PhabricatorTransactions::TYPE_COMMENT: case DifferentialTransaction::TYPE_ACTION: case DifferentialTransaction::TYPE_UPDATE: case DifferentialTransaction::TYPE_INLINE: $this->didExpandInlineState = true; $actor_phid = $this->getActingAsPHID(); $actor_is_author = $object->getAuthorPHID() == $actor_phid; if (!$actor_is_author) { break; } $state_map = PhabricatorTransactions::getInlineStateMap(); $inlines = id(new DifferentialDiffInlineCommentQuery())->setViewer($this->getActor())->withRevisionPHIDs(array($object->getPHID()))->withFixedStates(array_keys($state_map))->execute(); if (!$inlines) { break; } $old_value = mpull($inlines, 'getFixedState', 'getPHID'); $new_value = array(); foreach ($old_value as $key => $state) { $new_value[$key] = $state_map[$state]; } $results[] = id(new DifferentialTransaction())->setTransactionType(PhabricatorTransactions::TYPE_INLINESTATE)->setIgnoreOnNoEffect(true)->setOldValue($old_value)->setNewValue($new_value); break; } } return $results; }
/** * Start builds for a given buildable. * * @param phid PHID of the object to build. * @param phid Container PHID for the buildable. * @param list<HarbormasterBuildRequest> List of builds to perform. * @return void */ public static function applyBuildPlans($phid, $container_phid, array $requests) { assert_instances_of($requests, 'HarbormasterBuildRequest'); if (!$requests) { return; } // Skip all of this logic if the Harbormaster application // isn't currently installed. $harbormaster_app = 'PhabricatorHarbormasterApplication'; if (!PhabricatorApplication::isClassInstalled($harbormaster_app)) { return; } $viewer = PhabricatorUser::getOmnipotentUser(); $buildable = self::createOrLoadExisting($viewer, $phid, $container_phid); $plan_phids = mpull($requests, 'getBuildPlanPHID'); $plans = id(new HarbormasterBuildPlanQuery())->setViewer($viewer)->withPHIDs($plan_phids)->execute(); $plans = mpull($plans, null, 'getPHID'); foreach ($requests as $request) { $plan_phid = $request->getBuildPlanPHID(); $plan = idx($plans, $plan_phid); if (!$plan) { throw new Exception(pht('Failed to load build plan ("%s").', $plan_phid)); } if ($plan->isDisabled()) { // TODO: This should be communicated more clearly -- maybe we should // create the build but set the status to "disabled" or "derelict". continue; } $parameters = $request->getBuildParameters(); $buildable->applyPlan($plan, $parameters, $request->getInitiatorPHID()); } }
public function isFieldEnabled() { return PhabricatorApplication::isClassInstalled('PhabricatorCalendarApplication'); }
private function updateNuanceImportCursors() { $nuance_app = 'PhabricatorNuanceApplication'; if (!PhabricatorApplication::isClassInstalled($nuance_app)) { return false; } // If we haven't loaded sources yet, load them first. if (!$this->nuanceSources && !$this->nuanceCursors) { $this->anyNuanceData = false; $sources = id(new NuanceSourceQuery())->setViewer($this->getViewer())->withIsDisabled(false)->withHasImportCursors(true)->execute(); if (!$sources) { return false; } $this->nuanceSources = array_reverse($sources); } // If we don't have any cursors, move to the next source and generate its // cursors. if (!$this->nuanceCursors) { $source = array_pop($this->nuanceSources); $definition = $source->getDefinition()->setViewer($this->getViewer())->setSource($source); $cursors = $definition->getImportCursors(); $this->nuanceCursors = array_reverse($cursors); } // Update the next cursor. $cursor = array_pop($this->nuanceCursors); if ($cursor) { $more_data = $cursor->importFromSource(); if ($more_data) { $this->anyNuanceData = true; } } if (!$this->nuanceSources && !$this->nuanceCursors) { return $this->anyNuanceData; } return true; }
public function isExtensionEnabled() { return PhabricatorApplication::isClassInstalled('PhabricatorDifferentialApplication'); }
private function closeTasks(PhabricatorUser $actor, $acting_as, PhabricatorRepository $repository, PhabricatorRepositoryCommit $commit, $message) { $maniphest = 'PhabricatorManiphestApplication'; if (!PhabricatorApplication::isClassInstalled($maniphest)) { return; } $prefixes = ManiphestTaskStatus::getStatusPrefixMap(); $suffixes = ManiphestTaskStatus::getStatusSuffixMap(); $matches = id(new ManiphestCustomFieldStatusParser())->parseCorpus($message); $task_statuses = array(); foreach ($matches as $match) { $prefix = phutil_utf8_strtolower($match['prefix']); $suffix = phutil_utf8_strtolower($match['suffix']); $status = idx($suffixes, $suffix); if (!$status) { $status = idx($prefixes, $prefix); } foreach ($match['monograms'] as $task_monogram) { $task_id = (int) trim($task_monogram, 'tT'); $task_statuses[$task_id] = $status; } } if (!$task_statuses) { return; } $tasks = id(new ManiphestTaskQuery())->setViewer($actor)->withIDs(array_keys($task_statuses))->needProjectPHIDs(true)->execute(); foreach ($tasks as $task_id => $task) { $xactions = array(); $edge_type = ManiphestTaskHasCommitEdgeType::EDGECONST; $edge_xaction = id(new ManiphestTransaction())->setTransactionType(PhabricatorTransactions::TYPE_EDGE)->setMetadataValue('edge:type', $edge_type)->setNewValue(array('+' => array($commit->getPHID() => $commit->getPHID()))); $status = $task_statuses[$task_id]; if ($status) { if ($task->getStatus() != $status) { $xactions[] = id(new ManiphestTransaction())->setTransactionType(ManiphestTransaction::TYPE_STATUS)->setMetadataValue('commitPHID', $commit->getPHID())->setNewValue($status); $edge_xaction->setMetadataValue('commitPHID', $commit->getPHID()); } } $xactions[] = $edge_xaction; $content_source = PhabricatorContentSource::newForSource(PhabricatorContentSource::SOURCE_DAEMON, array()); $editor = id(new ManiphestTransactionEditor())->setActor($actor)->setActingAsPHID($acting_as)->setContinueOnNoEffect(true)->setContinueOnMissingFields(true)->setUnmentionablePHIDMap(array($commit->getPHID() => $commit->getPHID()))->setContentSource($content_source); $editor->applyTransactions($task, $xactions); } }
public function isEnabled() { return PhabricatorApplication::isClassInstalled('PhabricatorBadgesApplication'); }
public function isEnabled() { $app_name = 'PhabricatorOAuthServerApplication'; return PhabricatorApplication::isClassInstalled($app_name); }
public function isEnabled() { return PhabricatorApplication::isClassInstalled('PhabricatorSlowvoteApplication'); }
/** * Looks up the plan PHIDs and applies the plans to the specified * object identified by it's PHID. */ public static function applyBuildPlans($phid, $container_phid, array $plan_phids) { if (!$plan_phids) { return; } // Skip all of this logic if the Harbormaster application // isn't currently installed. $harbormaster_app = 'PhabricatorHarbormasterApplication'; if (!PhabricatorApplication::isClassInstalled($harbormaster_app)) { return; } $buildable = self::createOrLoadExisting(PhabricatorUser::getOmnipotentUser(), $phid, $container_phid); $plans = id(new HarbormasterBuildPlanQuery())->setViewer(PhabricatorUser::getOmnipotentUser())->withPHIDs($plan_phids)->execute(); foreach ($plans as $plan) { if ($plan->isDisabled()) { // TODO: This should be communicated more clearly -- maybe we should // create the build but set the status to "disabled" or "derelict". continue; } $buildable->applyPlan($plan); } }
public function isExtensionEnabled() { return PhabricatorApplication::isClassInstalled('PhabricatorSpacesApplication'); }
public function isEnabled() { return PhabricatorApplication::isClassInstalled('PhabricatorCountdownApplication'); }
public function isEnabled() { $app_class = 'PhabricatorPonderApplication'; return PhabricatorApplication::isClassInstalled($app_class); }
public function isEnabled() { return PhabricatorApplication::isClassInstalled('PhabricatorManiphestApplication'); }
private function getRevisionActions(DifferentialRevision $revision) { $viewer = $this->getRequest()->getUser(); $revision_id = $revision->getID(); $revision_phid = $revision->getPHID(); $can_edit = PhabricatorPolicyFilter::hasCapability($viewer, $revision, PhabricatorPolicyCapability::CAN_EDIT); $actions = array(); $actions[] = id(new PhabricatorActionView())->setIcon('fa-pencil')->setHref("/differential/revision/edit/{$revision_id}/")->setName(pht('Edit Revision'))->setDisabled(!$can_edit)->setWorkflow(!$can_edit); $actions[] = id(new PhabricatorActionView())->setIcon('fa-upload')->setHref("/differential/revision/update/{$revision_id}/")->setName(pht('Update Diff'))->setDisabled(!$can_edit)->setWorkflow(!$can_edit); $this->requireResource('phabricator-object-selector-css'); $this->requireResource('javelin-behavior-phabricator-object-selector'); $actions[] = id(new PhabricatorActionView())->setIcon('fa-link')->setName(pht('Edit Dependencies'))->setHref("/search/attach/{$revision_phid}/DREV/dependencies/")->setWorkflow(true)->setDisabled(!$can_edit); $maniphest = 'PhabricatorManiphestApplication'; if (PhabricatorApplication::isClassInstalled($maniphest)) { $actions[] = id(new PhabricatorActionView())->setIcon('fa-anchor')->setName(pht('Edit Maniphest Tasks'))->setHref("/search/attach/{$revision_phid}/TASK/")->setWorkflow(true)->setDisabled(!$can_edit); } $request_uri = $this->getRequest()->getRequestURI(); $actions[] = id(new PhabricatorActionView())->setIcon('fa-download')->setName(pht('Download Raw Diff'))->setHref($request_uri->alter('download', 'true')); return $actions; }
private function enrichCurtain(PHUICurtainView $curtain, DiffusionRequest $drequest, $show_blame, $show_color) { $viewer = $this->getViewer(); $base_uri = $this->getRequest()->getRequestURI(); $curtain->addAction(id(new PhabricatorActionView())->setName(pht('Show Last Change'))->setHref($drequest->generateURI(array('action' => 'change')))->setIcon('fa-backward')); if ($show_blame) { $blame_text = pht('Disable Blame'); $blame_icon = 'fa-exclamation-circle lightgreytext'; $blame_value = 0; } else { $blame_text = pht('Enable Blame'); $blame_icon = 'fa-exclamation-circle'; $blame_value = 1; } $curtain->addAction(id(new PhabricatorActionView())->setName($blame_text)->setHref($base_uri->alter('blame', $blame_value))->setIcon($blame_icon)->setUser($viewer)->setRenderAsForm($viewer->isLoggedIn())); if ($show_color) { $highlight_text = pht('Disable Highlighting'); $highlight_icon = 'fa-star-o grey'; $highlight_value = 0; } else { $highlight_text = pht('Enable Highlighting'); $highlight_icon = 'fa-star'; $highlight_value = 1; } $curtain->addAction(id(new PhabricatorActionView())->setName($highlight_text)->setHref($base_uri->alter('color', $highlight_value))->setIcon($highlight_icon)->setUser($viewer)->setRenderAsForm($viewer->isLoggedIn())); $href = null; if ($this->getRequest()->getStr('lint') !== null) { $lint_text = pht('Hide %d Lint Message(s)', count($this->lintMessages)); $href = $base_uri->alter('lint', null); } else { if ($this->lintCommit === null) { $lint_text = pht('Lint not Available'); } else { $lint_text = pht('Show %d Lint Message(s)', count($this->lintMessages)); $href = $this->getDiffusionRequest()->generateURI(array('action' => 'browse', 'commit' => $this->lintCommit))->alter('lint', ''); } } $curtain->addAction(id(new PhabricatorActionView())->setName($lint_text)->setHref($href)->setIcon('fa-exclamation-triangle')->setDisabled(!$href)); $repository = $drequest->getRepository(); $owners = 'PhabricatorOwnersApplication'; if (PhabricatorApplication::isClassInstalled($owners)) { $package_query = id(new PhabricatorOwnersPackageQuery())->setViewer($viewer)->withStatuses(array(PhabricatorOwnersPackage::STATUS_ACTIVE))->withControl($repository->getPHID(), array($drequest->getPath())); $package_query->execute(); $packages = $package_query->getControllingPackagesForPath($repository->getPHID(), $drequest->getPath()); if ($packages) { $ownership = id(new PHUIStatusListView())->setUser($viewer); foreach ($packages as $package) { $icon = 'fa-list-alt'; $color = 'grey'; $item = id(new PHUIStatusItemView())->setIcon($icon, $color)->setTarget($viewer->renderHandle($package->getPHID())); $ownership->addItem($item); } } else { $ownership = phutil_tag('em', array(), pht('None')); } $curtain->newPanel()->setHeaderText(pht('Owners'))->appendChild($ownership); } return $curtain; }
private function renderHeadsupActionList(PhabricatorRepositoryCommit $commit, PhabricatorRepository $repository) { $request = $this->getRequest(); $user = $request->getUser(); $actions = id(new PhabricatorActionListView())->setUser($user)->setObject($commit)->setObjectURI($request->getRequestURI()); $can_edit = PhabricatorPolicyFilter::hasCapability($user, $commit, PhabricatorPolicyCapability::CAN_EDIT); $uri = '/diffusion/' . $repository->getCallsign() . '/commit/' . $commit->getCommitIdentifier() . '/edit/'; $action = id(new PhabricatorActionView())->setName(pht('Edit Commit'))->setHref($uri)->setIcon('fa-pencil')->setDisabled(!$can_edit)->setWorkflow(!$can_edit); $actions->addAction($action); require_celerity_resource('phabricator-object-selector-css'); require_celerity_resource('javelin-behavior-phabricator-object-selector'); $maniphest = 'PhabricatorManiphestApplication'; if (PhabricatorApplication::isClassInstalled($maniphest)) { $action = id(new PhabricatorActionView())->setName(pht('Edit Maniphest Tasks'))->setIcon('fa-anchor')->setHref('/search/attach/' . $commit->getPHID() . '/TASK/edge/')->setWorkflow(true)->setDisabled(!$can_edit); $actions->addAction($action); } $action = id(new PhabricatorActionView())->setName(pht('Download Raw Diff'))->setHref($request->getRequestURI()->alter('diff', true))->setIcon('fa-download'); $actions->addAction($action); return $actions; }
public function isEnabled() { return PhabricatorApplication::isClassInstalled('PhabricatorConpherenceApplication'); }