protected function applyCustomInternalTransaction(PhabricatorLiskDAO $object, PhabricatorApplicationTransaction $xaction) { $new = $xaction->getNewValue(); switch ($xaction->getTransactionType()) { case ReleephRequestTransaction::TYPE_REQUEST: $object->setRequestCommitPHID($new); break; case ReleephRequestTransaction::TYPE_USER_INTENT: $user_phid = $xaction->getAuthorPHID(); $intents = $object->getUserIntents(); $intents[$user_phid] = $new; $object->setUserIntents($intents); break; case ReleephRequestTransaction::TYPE_EDIT_FIELD: $field = newv($xaction->getMetadataValue('fieldClass'), array()); $field->setReleephRequest($object)->setValue($new); break; case ReleephRequestTransaction::TYPE_PICK_STATUS: $object->setPickStatus($new); break; case ReleephRequestTransaction::TYPE_COMMIT: $this->setInBranchFromAction($object, $xaction); $object->setCommitIdentifier($new); break; case ReleephRequestTransaction::TYPE_DISCOVERY: $this->setInBranchFromAction($object, $xaction); $object->setCommitPHID($new); break; case ReleephRequestTransaction::TYPE_MANUAL_IN_BRANCH: $object->setInBranch((int) $new); break; } }
protected function applyCustomInternalTransaction(PhabricatorLiskDAO $object, PhabricatorApplicationTransaction $xaction) { switch ($xaction->getTransactionType()) { case HeraldRuleTransaction::TYPE_DISABLE: return $object->setIsDisabled($xaction->getNewValue()); } }
protected function applyCustomExternalTransaction(PhabricatorLiskDAO $object, PhabricatorApplicationTransaction $xaction) { switch ($xaction->getTransactionType()) { case AlmanacBindingTransaction::TYPE_DISABLE: return; case AlmanacBindingTransaction::TYPE_INTERFACE: $interface_phids = array(); $interface_phids[] = $xaction->getOldValue(); $interface_phids[] = $xaction->getNewValue(); $interface_phids = array_filter($interface_phids); $interface_phids = array_unique($interface_phids); $interfaces = id(new AlmanacInterfaceQuery())->setViewer(PhabricatorUser::getOmnipotentUser())->withPHIDs($interface_phids)->execute(); $device_phids = array(); foreach ($interfaces as $interface) { $device_phids[] = $interface->getDevicePHID(); } $device_phids = array_unique($device_phids); $devices = id(new AlmanacDeviceQuery())->setViewer(PhabricatorUser::getOmnipotentUser())->withPHIDs($device_phids)->execute(); foreach ($devices as $device) { $device->rebuildClusterBindingStatus(); } return; } return parent::applyCustomExternalTransaction($object, $xaction); }
protected function applyCustomInternalTransaction(PhabricatorLiskDAO $object, PhabricatorApplicationTransaction $xaction) { $value = $xaction->getNewValue(); switch ($xaction->getTransactionType()) { case PhabricatorAuthSSHKeyTransaction::TYPE_NAME: $object->setName($value); return; case PhabricatorAuthSSHKeyTransaction::TYPE_KEY: $public_key = PhabricatorAuthSSHPublicKey::newFromRawKey($value); $type = $public_key->getType(); $body = $public_key->getBody(); $comment = $public_key->getComment(); $object->setKeyType($type); $object->setKeyBody($body); $object->setKeyComment($comment); return; case PhabricatorAuthSSHKeyTransaction::TYPE_DEACTIVATE: if ($value) { $new = null; } else { $new = 1; } $object->setIsActive($new); return; } }
protected function renderTransactionContent(PhabricatorApplicationTransaction $xaction) { $out = array(); $group = $xaction->getTransactionGroup(); if ($xaction->getTransactionType() == PholioTransaction::TYPE_INLINE) { array_unshift($group, $xaction); } else { $out[] = parent::renderTransactionContent($xaction); } if (!$group) { return $out; } $inlines = array(); foreach ($group as $xaction) { switch ($xaction->getTransactionType()) { case PholioTransaction::TYPE_INLINE: $inlines[] = $xaction; break; default: throw new Exception(pht('Unknown grouped transaction type!')); } } if ($inlines) { $icon = id(new PHUIIconView())->setIconFont('fa-comment bluegrey msr'); $header = phutil_tag('div', array('class' => 'phabricator-transaction-subheader'), array($icon, pht('Inline Comments'))); $out[] = $header; foreach ($inlines as $inline) { if (!$inline->getComment()) { continue; } $out[] = $this->renderInlineContent($inline); } } return $out; }
protected function applyCustomExternalTransaction(PhabricatorLiskDAO $object, PhabricatorApplicationTransaction $xaction) { switch ($xaction->getTransactionType()) { case PhabricatorTransactions::TYPE_COMMENT: case PhabricatorTransactions::TYPE_SUBSCRIBERS: case PhabricatorTransactions::TYPE_EDGE: case PhabricatorAuditActionConstants::ACTION: case PhabricatorAuditActionConstants::INLINE: return; case PhabricatorAuditActionConstants::ADD_AUDITORS: $new = $xaction->getNewValue(); if (!is_array($new)) { $new = array(); } $old = $xaction->getOldValue(); if (!is_array($old)) { $old = array(); } $add = array_diff_key($new, $old); $actor = $this->requireActor(); $requests = $object->getAudits(); $requests = mpull($requests, null, 'getAuditorPHID'); foreach ($add as $phid) { if (isset($requests[$phid])) { continue; } $audit_requested = PhabricatorAuditStatusConstants::AUDIT_REQUESTED; $requests[] = id(new PhabricatorRepositoryAuditRequest())->setCommitPHID($object->getPHID())->setAuditorPHID($phid)->setAuditStatus($audit_requested)->setAuditReasons(array('Added by ' . $actor->getUsername()))->save(); } $object->attachAudits($requests); return; } return parent::applyCustomExternalTransaction($object, $xaction); }
protected function applyCustomExternalTransaction(PhabricatorLiskDAO $object, PhabricatorApplicationTransaction $xaction) { switch ($xaction->getTransactionType()) { case AlmanacDeviceTransaction::TYPE_NAME: return; case AlmanacDeviceTransaction::TYPE_INTERFACE: $old = $xaction->getOldValue(); if ($old) { $interface = id(new AlmanacInterfaceQuery())->setViewer($this->requireActor())->withIDs(array($old['id']))->executeOne(); if (!$interface) { throw new Exception(pht('Unable to load interface!')); } } else { $interface = AlmanacInterface::initializeNewInterface()->setDevicePHID($object->getPHID()); } $new = $xaction->getNewValue(); if ($new) { $interface->setNetworkPHID($new['networkPHID'])->setAddress($new['address'])->setPort((int) $new['port']); if (idx($new, 'phid')) { $interface->setPHID($new['phid']); } $interface->save(); } else { $interface->delete(); } return; } return parent::applyCustomExternalTransaction($object, $xaction); }
protected function renderTransactionContent(PhabricatorApplicationTransaction $xaction) { $out = array(); $type_inline = DifferentialTransaction::TYPE_INLINE; $group = $xaction->getTransactionGroup(); if ($xaction->getTransactionType() == $type_inline) { array_unshift($group, $xaction); } else { $out[] = parent::renderTransactionContent($xaction); } if (!$group) { return $out; } $inlines = array(); foreach ($group as $xaction) { switch ($xaction->getTransactionType()) { case DifferentialTransaction::TYPE_INLINE: $inlines[] = $xaction; break; default: throw new Exception('Unknown grouped transaction type!'); } } if ($inlines) { $inline_view = new PhabricatorInlineSummaryView(); $changesets = $this->getChangesets(); $inline_groups = DifferentialTransactionComment::sortAndGroupInlines($inlines, $changesets); foreach ($inline_groups as $changeset_id => $group) { $changeset = $changesets[$changeset_id]; $items = array(); foreach ($group as $inline) { $comment = $inline->getComment(); $item = array('id' => $comment->getID(), 'line' => $comment->getLineNumber(), 'length' => $comment->getLineLength(), 'content' => parent::renderTransactionContent($inline)); $changeset_diff_id = $changeset->getDiffID(); if ($comment->getIsNewFile()) { $visible_diff_id = $this->getRightDiff()->getID(); } else { $visible_diff_id = $this->getLeftDiff()->getID(); } // TODO: We still get one edge case wrong here, when we have a // versus diff and the file didn't exist in the old version. The // comment is visible because we show the left side of the target // diff when there's no corresponding file in the versus diff, but // we incorrectly link it off-page. $is_visible = $changeset_diff_id == $visible_diff_id; if (!$is_visible) { $item['where'] = pht('(On Diff #%d)', $changeset_diff_id); $revision_id = $this->getRevision()->getID(); $comment_id = $comment->getID(); $item['href'] = '/D' . $revision_id . '?id=' . $changeset_diff_id . '#inline-' . $comment_id; } $items[] = $item; } $inline_view->addCommentGroup($changeset->getFilename(), $items); } $out[] = $inline_view; } return $out; }
protected function applyCustomExternalTransaction(PhabricatorLiskDAO $object, PhabricatorApplicationTransaction $xaction) { switch ($xaction->getTransactionType()) { case PhabricatorEditEngineConfigurationTransaction::TYPE_NAME: return; } return parent::applyCustomExternalTransaction($object, $xaction); }
protected function applyCustomInternalTransaction(PhabricatorLiskDAO $object, PhabricatorApplicationTransaction $xaction) { switch ($xaction->getTransactionType()) { case PhabricatorFileTransaction::TYPE_NAME: $object->setName($xaction->getNewValue()); break; } }
protected function applyCustomExternalTransaction(PhabricatorLiskDAO $object, PhabricatorApplicationTransaction $xaction) { switch ($xaction->getTransactionType()) { case NuanceRequestorTransaction::TYPE_PROPERTY: return; } return parent::applyCustomExternalTransaction($object, $xaction); }
protected function applyCustomExternalTransaction(PhabricatorLiskDAO $object, PhabricatorApplicationTransaction $xaction) { switch ($xaction->getTransactionType()) { case PhabricatorUserPreferencesTransaction::TYPE_SETTING: return; } return parent::applyCustomExternalTransaction($object, $xaction); }
protected function applyCustomInternalTransaction(PhabricatorLiskDAO $object, PhabricatorApplicationTransaction $xaction) { switch ($xaction->getTransactionType()) { case PhabricatorTransactions::TYPE_VIEW_POLICY: $object->setViewPolicy($xaction->getNewValue()); break; } }
protected function applyCustomExternalTransaction(PhabricatorLiskDAO $object, PhabricatorApplicationTransaction $xaction) { switch ($xaction->getTransactionType()) { case FundBackerTransaction::TYPE_STATUS: return; } return parent::applyCustomExternalTransaction($object, $xaction); }
protected function extractFilePHIDsFromCustomTransaction(PhabricatorLiskDAO $object, PhabricatorApplicationTransaction $xaction) { switch ($xaction->getTransactionType()) { case PhabricatorPasteTransaction::TYPE_CONTENT: return array($xaction->getNewValue()); } return parent::extractFilePHIDsFromCustomTransaction($object, $xaction); }
protected function applyCustomExternalTransaction(PhabricatorLiskDAO $object, PhabricatorApplicationTransaction $xaction) { switch ($xaction->getTransactionType()) { case DifferentialDiffTransaction::TYPE_DIFF_CREATE: return; } return parent::applyCustomExternalTransaction($object, $xaction); }
protected function applyCustomExternalTransaction(PhabricatorLiskDAO $object, PhabricatorApplicationTransaction $xaction) { switch ($xaction->getTransactionType()) { case AlmanacNetworkTransaction::TYPE_NAME: return; } return parent::applyCustomExternalTransaction($object, $xaction); }
public function applyCustomInternalTransaction(PhabricatorLiskDAO $object, PhabricatorApplicationTransaction $xaction) { $new = $xaction->getNewValue(); switch ($xaction->getTransactionType()) { case ReleephProductTransaction::TYPE_ACTIVE: $object->setIsActive($new); break; } }
protected function applyCustomExternalTransaction(PhabricatorLiskDAO $object, PhabricatorApplicationTransaction $xaction) { switch ($xaction->getTransactionType()) { case PhabricatorDashboardTransaction::TYPE_NAME: case PhabricatorDashboardTransaction::TYPE_LAYOUT_MODE: return; } return parent::applyCustomExternalTransaction($object, $xaction); }
protected function applyCustomExternalTransaction(PhabricatorLiskDAO $object, PhabricatorApplicationTransaction $xaction) { switch ($xaction->getTransactionType()) { case HarbormasterBuildTransaction::TYPE_CREATE: case HarbormasterBuildTransaction::TYPE_COMMAND: return; } return parent::applyCustomExternalTransaction($object, $xaction); }
protected function mergeTransactions(PhabricatorApplicationTransaction $u, PhabricatorApplicationTransaction $v) { $type = $u->getTransactionType(); switch ($type) { case PonderAnswerTransaction::TYPE_CONTENT: return $v; } return parent::mergeTransactions($u, $v); }
protected function applyCustomExternalTransaction(PhabricatorLiskDAO $object, PhabricatorApplicationTransaction $xaction) { switch ($xaction->getTransactionType()) { case NuanceSourceTransaction::TYPE_NAME: case NuanceSourceTransaction::TYPE_DEFAULT_QUEUE: return; } return parent::applyCustomExternalTransaction($object, $xaction); }
protected function applyCustomExternalTransaction(PhabricatorLiskDAO $object, PhabricatorApplicationTransaction $xaction) { switch ($xaction->getTransactionType()) { case PhortuneMerchantTransaction::TYPE_NAME: case PhortuneMerchantTransaction::TYPE_DESCRIPTION: return; } return parent::applyCustomExternalTransaction($object, $xaction); }
protected function applyCustomExternalTransaction(PhabricatorLiskDAO $object, PhabricatorApplicationTransaction $xaction) { switch ($xaction->getTransactionType()) { case DrydockBlueprintTransaction::TYPE_NAME: case DrydockBlueprintTransaction::TYPE_DISABLED: return; } return parent::applyCustomExternalTransaction($object, $xaction); }
protected function applyCustomExternalTransaction(PhabricatorLiskDAO $object, PhabricatorApplicationTransaction $xaction) { switch ($xaction->getTransactionType()) { case PhluxTransaction::TYPE_EDIT_KEY: case PhluxTransaction::TYPE_EDIT_VALUE: return; } return parent::applyCustomExternalTransaction($object, $xaction); }
protected function applyCustomExternalTransaction(PhabricatorLiskDAO $object, PhabricatorApplicationTransaction $xaction) { switch ($xaction->getTransactionType()) { case PhabricatorMetaMTAApplicationEmailTransaction::TYPE_ADDRESS: case PhabricatorMetaMTAApplicationEmailTransaction::TYPE_CONFIG: return; } return parent::applyCustomExternalTransaction($object, $xaction); }
protected function renderTransactionContent(PhabricatorApplicationTransaction $xaction) { $out = array(); $type_inline = PhabricatorAuditActionConstants::INLINE; $group = $xaction->getTransactionGroup(); if ($xaction->getTransactionType() == $type_inline) { array_unshift($group, $xaction); } else { $out[] = parent::renderTransactionContent($xaction); } if (!$group) { return $out; } $inlines = array(); foreach ($group as $xaction) { switch ($xaction->getTransactionType()) { case PhabricatorAuditActionConstants::INLINE: $inlines[] = $xaction; break; default: throw new Exception('Unknown grouped transaction type!'); } } if ($inlines) { // TODO: This should do something similar to sortAndGroupInlines() to get // a stable ordering. $inlines_by_path = array(); foreach ($inlines as $key => $inline) { $comment = $inline->getComment(); if (!$comment) { // TODO: Migrate these away? They probably do not exist on normal // non-development installs. unset($inlines[$key]); continue; } $path_id = $comment->getPathID(); $inlines_by_path[$path_id][] = $inline; } $inline_view = new PhabricatorInlineSummaryView(); foreach ($inlines_by_path as $path_id => $group) { $path = idx($this->pathMap, $path_id); if ($path === null) { continue; } $items = array(); foreach ($group as $inline) { $comment = $inline->getComment(); $item = array('id' => $comment->getID(), 'line' => $comment->getLineNumber(), 'length' => $comment->getLineLength(), 'content' => parent::renderTransactionContent($inline)); $items[] = $item; } $inline_view->addCommentGroup($path, $items); } $out[] = $inline_view; } return $out; }
protected function applyCustomExternalTransaction(PhabricatorLiskDAO $object, PhabricatorApplicationTransaction $xaction) { switch ($xaction->getTransactionType()) { case PhortunePaymentProviderConfigTransaction::TYPE_CREATE: case PhortunePaymentProviderConfigTransaction::TYPE_PROPERTY: case PhortunePaymentProviderConfigTransaction::TYPE_ENABLE: return; } return parent::applyCustomExternalTransaction($object, $xaction); }
protected function applyCustomExternalTransaction(PhabricatorLiskDAO $object, PhabricatorApplicationTransaction $xaction) { switch ($xaction->getTransactionType()) { case PhortuneProductTransaction::TYPE_NAME: case PhortuneProductTransaction::TYPE_TYPE: case PhortuneProductTransaction::TYPE_PRICE: return; } return parent::applyCustomExternalTransaction($object, $xaction); }
protected function applyCustomExternalTransaction(PhabricatorLiskDAO $object, PhabricatorApplicationTransaction $xaction) { switch ($xaction->getTransactionType()) { case PhabricatorProfilePanelConfigurationTransaction::TYPE_PROPERTY: case PhabricatorProfilePanelConfigurationTransaction::TYPE_ORDER: case PhabricatorProfilePanelConfigurationTransaction::TYPE_VISIBILITY: return; } return parent::applyCustomExternalTransaction($object, $xaction); }