当前位置: 首页>>代码示例>>PHP>>正文


PHP PhabricatorApplicationTransaction类代码示例

本文整理汇总了PHP中PhabricatorApplicationTransaction的典型用法代码示例。如果您正苦于以下问题:PHP PhabricatorApplicationTransaction类的具体用法?PHP PhabricatorApplicationTransaction怎么用?PHP PhabricatorApplicationTransaction使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PhabricatorApplicationTransaction类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: applyCustomInternalTransaction

 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;
     }
 }
开发者ID:NeoArmageddon,项目名称:phabricator,代码行数:26,代码来源:PhabricatorAuthSSHKeyEditor.php

示例2: applyCustomInternalTransaction

 protected function applyCustomInternalTransaction(PhabricatorLiskDAO $object, PhabricatorApplicationTransaction $xaction)
 {
     switch ($xaction->getTransactionType()) {
         case HeraldRuleTransaction::TYPE_DISABLE:
             return $object->setIsDisabled($xaction->getNewValue());
     }
 }
开发者ID:pugong,项目名称:phabricator,代码行数:7,代码来源:HeraldRuleEditor.php

示例3: applyCustomExternalTransaction

 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);
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:25,代码来源:AlmanacBindingEditor.php

示例4: renderTransactionContent

 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;
 }
开发者ID:patelhardik,项目名称:phabricator,代码行数:35,代码来源:PholioTransactionView.php

示例5: applyCustomExternalTransaction

 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);
 }
开发者ID:denghp,项目名称:phabricator,代码行数:34,代码来源:PhabricatorAuditEditor.php

示例6: destroyTransactions

 private function destroyTransactions(PhabricatorApplicationTransaction $template, $object_phid)
 {
     $xactions = $template->loadAllWhere('objectPHID = %s', $object_phid);
     foreach ($xactions as $xaction) {
         $this->destroyObject($xaction);
     }
 }
开发者ID:denghp,项目名称:phabricator,代码行数:7,代码来源:PhabricatorDestructionEngine.php

示例7: applyCustomExternalTransaction

 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);
 }
开发者ID:pugong,项目名称:phabricator,代码行数:29,代码来源:AlmanacDeviceEditor.php

示例8: renderTransactionContent

 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;
 }
开发者ID:denghp,项目名称:phabricator,代码行数:59,代码来源:DifferentialTransactionView.php

示例9: applyCustomExternalTransaction

 protected function applyCustomExternalTransaction(PhabricatorLiskDAO $object, PhabricatorApplicationTransaction $xaction)
 {
     switch ($xaction->getTransactionType()) {
         case PhabricatorEditEngineConfigurationTransaction::TYPE_NAME:
             return;
     }
     return parent::applyCustomExternalTransaction($object, $xaction);
 }
开发者ID:hamilyjing,项目名称:phabricator,代码行数:8,代码来源:PhabricatorEditEngineConfigurationEditor.php

示例10: applyCustomInternalTransaction

 protected function applyCustomInternalTransaction(PhabricatorLiskDAO $object, PhabricatorApplicationTransaction $xaction)
 {
     switch ($xaction->getTransactionType()) {
         case PhabricatorFileTransaction::TYPE_NAME:
             $object->setName($xaction->getNewValue());
             break;
     }
 }
开发者ID:pugong,项目名称:phabricator,代码行数:8,代码来源:PhabricatorFileEditor.php

示例11: generateTransaction

 public function generateTransaction(PhabricatorApplicationTransaction $template, array $spec)
 {
     $template->setTransactionType($this->getTransactionType())->setNewValue(idx($spec, 'value'));
     foreach ($this->getMetadata() as $key => $value) {
         $template->setMetadataValue($key, $value);
     }
     return $template;
 }
开发者ID:hamilyjing,项目名称:phabricator,代码行数:8,代码来源:PhabricatorSimpleEditType.php

示例12: applyCustomExternalTransaction

 protected function applyCustomExternalTransaction(PhabricatorLiskDAO $object, PhabricatorApplicationTransaction $xaction)
 {
     switch ($xaction->getTransactionType()) {
         case PhabricatorUserPreferencesTransaction::TYPE_SETTING:
             return;
     }
     return parent::applyCustomExternalTransaction($object, $xaction);
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:8,代码来源:PhabricatorUserPreferencesEditor.php

示例13: applyCustomInternalTransaction

 protected function applyCustomInternalTransaction(PhabricatorLiskDAO $object, PhabricatorApplicationTransaction $xaction)
 {
     switch ($xaction->getTransactionType()) {
         case PhabricatorTransactions::TYPE_VIEW_POLICY:
             $object->setViewPolicy($xaction->getNewValue());
             break;
     }
 }
开发者ID:denghp,项目名称:phabricator,代码行数:8,代码来源:PhabricatorFileEditor.php

示例14: applyApplicationTransactionInternalEffects

 public function applyApplicationTransactionInternalEffects(PhabricatorApplicationTransaction $xaction)
 {
     $object = $this->getObject();
     $key = $this->getProxy()->getRawStandardFieldKey();
     $this->setValueFromApplicationTransactions($xaction->getNewValue());
     $value = $this->getValueForStorage();
     $object->setProperty($key, $value);
 }
开发者ID:pugong,项目名称:phabricator,代码行数:8,代码来源:PhabricatorDashboardPanelCoreCustomField.php

示例15: applyCustomExternalTransaction

 protected function applyCustomExternalTransaction(PhabricatorLiskDAO $object, PhabricatorApplicationTransaction $xaction)
 {
     switch ($xaction->getTransactionType()) {
         case AlmanacNetworkTransaction::TYPE_NAME:
             return;
     }
     return parent::applyCustomExternalTransaction($object, $xaction);
 }
开发者ID:pugong,项目名称:phabricator,代码行数:8,代码来源:AlmanacNetworkEditor.php


注:本文中的PhabricatorApplicationTransaction类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。