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


PHP PhabricatorApplicationTransactionEditor类代码示例

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


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

示例1: updateTransactionMailBody

 public function updateTransactionMailBody(PhabricatorMetaMTAMailBody $body, PhabricatorApplicationTransactionEditor $editor, array $xactions)
 {
     $status_accepted = ArcanistDifferentialRevisionStatus::ACCEPTED;
     // Show the "BRANCH" section only if there's a new diff or the revision
     // is "Accepted".
     if (!$editor->getDiffUpdateTransaction($xactions) && $this->getObject()->getStatus() != $status_accepted) {
         return;
     }
     $branch = $this->getBranchDescription($this->getObject()->getActiveDiff());
     if ($branch === null) {
         return;
     }
     $body->addTextSection(pht('BRANCH'), $branch);
 }
开发者ID:patelhardik,项目名称:phabricator,代码行数:14,代码来源:DifferentialBranchField.php

示例2: validateTransaction

 protected function validateTransaction(PhabricatorLiskDAO $object, $type, array $xactions)
 {
     $errors = parent::validateTransaction($object, $type, $xactions);
     switch ($type) {
         case AlmanacBindingTransaction::TYPE_INTERFACE:
             $missing = $this->validateIsEmptyTextField($object->getInterfacePHID(), $xactions);
             if ($missing) {
                 $error = new PhabricatorApplicationTransactionValidationError($type, pht('Required'), pht('Bindings must specify an interface.'), nonempty(last($xactions), null));
                 $error->setIsMissingFieldError(true);
                 $errors[] = $error;
             } else {
                 if ($xactions) {
                     foreach ($xactions as $xaction) {
                         $interfaces = id(new AlmanacInterfaceQuery())->setViewer($this->requireActor())->withPHIDs(array($xaction->getNewValue()))->execute();
                         if (!$interfaces) {
                             $error = new PhabricatorApplicationTransactionValidationError($type, pht('Invalid'), pht('You can not bind a service to an invalid or restricted ' . 'interface.'), $xaction);
                             $errors[] = $error;
                         }
                     }
                     $final_value = last($xactions)->getNewValue();
                     $binding = id(new AlmanacBindingQuery())->setViewer(PhabricatorUser::getOmnipotentUser())->withServicePHIDs(array($object->getServicePHID()))->withInterfacePHIDs(array($final_value))->executeOne();
                     if ($binding && $binding->getID() != $object->getID()) {
                         $error = new PhabricatorApplicationTransactionValidationError($type, pht('Already Bound'), pht('You can not bind a service to the same interface multiple ' . 'times.'), last($xactions));
                         $errors[] = $error;
                     }
                 }
             }
             break;
     }
     return $errors;
 }
开发者ID:pugong,项目名称:phabricator,代码行数:31,代码来源:AlmanacBindingEditor.php

示例3: validateTransaction

 protected function validateTransaction(PhabricatorLiskDAO $object, $type, array $xactions)
 {
     $errors = parent::validateTransaction($object, $type, $xactions);
     switch ($type) {
         case PhamePostTransaction::TYPE_TITLE:
             $missing = $this->validateIsEmptyTextField($object->getTitle(), $xactions);
             if ($missing) {
                 $error = new PhabricatorApplicationTransactionValidationError($type, pht('Required'), pht('Title is required.'), nonempty(last($xactions), null));
                 $error->setIsMissingFieldError(true);
                 $errors[] = $error;
             }
             break;
         case PhamePostTransaction::TYPE_PHAME_TITLE:
             $missing = $this->validateIsEmptyTextField($object->getPhameTitle(), $xactions);
             $phame_title = last($xactions)->getNewValue();
             if ($missing || $phame_title == '/') {
                 $error = new PhabricatorApplicationTransactionValidationError($type, pht('Required'), pht('Phame title is required.'), nonempty(last($xactions), null));
                 $error->setIsMissingFieldError(true);
                 $errors[] = $error;
             }
             $duplicate_post = id(new PhamePostQuery())->setViewer(PhabricatorUser::getOmnipotentUser())->withPhameTitles(array($phame_title))->executeOne();
             if ($duplicate_post && $duplicate_post->getID() != $object->getID()) {
                 $error_text = pht('Phame title must be unique; another post already has this phame ' . 'title.');
                 $error = new PhabricatorApplicationTransactionValidationError($type, pht('Not Unique'), $error_text, nonempty(last($xactions), null));
                 $errors[] = $error;
             }
             break;
     }
     return $errors;
 }
开发者ID:fengshao0907,项目名称:phabricator,代码行数:30,代码来源:PhamePostEditor.php

示例4: validateTransaction

 protected function validateTransaction(PhabricatorLiskDAO $object, $type, array $xactions)
 {
     $errors = parent::validateTransaction($object, $type, $xactions);
     switch ($type) {
         case PhabricatorMetaMTAApplicationEmailTransaction::TYPE_ADDRESS:
             foreach ($xactions as $xaction) {
                 $email = $xaction->getNewValue();
                 if (!strlen($email)) {
                     // We'll deal with this below.
                     continue;
                 }
                 if (!PhabricatorUserEmail::isValidAddress($email)) {
                     $errors[] = new PhabricatorApplicationTransactionValidationError($type, pht('Invalid'), pht('Email address is not formatted properly.'));
                 }
             }
             $missing = $this->validateIsEmptyTextField($object->getAddress(), $xactions);
             if ($missing) {
                 $error = new PhabricatorApplicationTransactionValidationError($type, pht('Required'), pht('You must provide an email address.'), nonempty(last($xactions), null));
                 $error->setIsMissingFieldError(true);
                 $errors[] = $error;
             }
             break;
     }
     return $errors;
 }
开发者ID:truSense,项目名称:phabricator,代码行数:25,代码来源:PhabricatorMetaMTAApplicationEmailEditor.php

示例5: getTransactionTypes

 public function getTransactionTypes()
 {
     $types = parent::getTransactionTypes();
     $types[] = PhabricatorTransactions::TYPE_VIEW_POLICY;
     $types[] = PhabricatorTransactions::TYPE_EDIT_POLICY;
     return $types;
 }
开发者ID:pugong,项目名称:phabricator,代码行数:7,代码来源:DivinerLiveBookEditor.php

示例6: validateTransaction

 /**
  * We run Herald as part of transaction validation because Herald can
  * block diff creation for Differential diffs. Its important to do this
  * separately so no Herald logs are saved; these logs could expose
  * information the Herald rules are inteneded to block.
  */
 protected function validateTransaction(PhabricatorLiskDAO $object, $type, array $xactions)
 {
     $errors = parent::validateTransaction($object, $type, $xactions);
     foreach ($xactions as $xaction) {
         switch ($type) {
             case DifferentialDiffTransaction::TYPE_DIFF_CREATE:
                 $diff = clone $object;
                 $diff = $this->updateDiffFromDict($diff, $xaction->getNewValue());
                 $adapter = $this->buildHeraldAdapter($diff, $xactions);
                 $adapter->setContentSource($this->getContentSource());
                 $adapter->setIsNewObject($this->getIsNewObject());
                 $engine = new HeraldEngine();
                 $rules = $engine->loadRulesForAdapter($adapter);
                 $rules = mpull($rules, null, 'getID');
                 $effects = $engine->applyRules($rules, $adapter);
                 $blocking_effect = null;
                 foreach ($effects as $effect) {
                     if ($effect->getAction() == HeraldAdapter::ACTION_BLOCK) {
                         $blocking_effect = $effect;
                         break;
                     }
                 }
                 if ($blocking_effect) {
                     $rule = $blocking_effect->getRule();
                     $message = $effect->getTarget();
                     if (!strlen($message)) {
                         $message = pht('(None.)');
                     }
                     $errors[] = new PhabricatorApplicationTransactionValidationError($type, pht('Rejected by Herald'), pht("Creation of this diff was rejected by Herald rule %s.\n" . "  Rule: %s\n" . "Reason: %s", $rule->getMonogram(), $rule->getName(), $message));
                 }
                 break;
         }
     }
     return $errors;
 }
开发者ID:hrb518,项目名称:phabricator,代码行数:41,代码来源:DifferentialDiffEditor.php

示例7: getTransactionTypes

 public function getTransactionTypes()
 {
     $types = parent::getTransactionTypes();
     $types[] = PhabricatorTransactions::TYPE_COMMENT;
     $types[] = HeraldRuleTransaction::TYPE_DISABLE;
     return $types;
 }
开发者ID:pugong,项目名称:phabricator,代码行数:7,代码来源:HeraldRuleEditor.php

示例8: buildMailBody

 protected function buildMailBody(PhabricatorLiskDAO $object, array $xactions)
 {
     $body = parent::buildMailBody($object, $xactions);
     $detail_uri = PhabricatorEnv::getProductionURI($object->getURI());
     $body->addLinkSection(pht('PACKAGE DETAIL'), $detail_uri);
     return $body;
 }
开发者ID:NeoArmageddon,项目名称:phabricator,代码行数:7,代码来源:PhabricatorOwnersPackageTransactionEditor.php

示例9: validateTransaction

 protected function validateTransaction(PhabricatorLiskDAO $object, $type, array $xactions)
 {
     $errors = parent::validateTransaction($object, $type, $xactions);
     switch ($type) {
         case PhortuneAccountTransaction::TYPE_NAME:
             $missing = $this->validateIsEmptyTextField($object->getName(), $xactions);
             if ($missing) {
                 $error = new PhabricatorApplicationTransactionValidationError($type, pht('Required'), pht('Account name is required.'), nonempty(last($xactions), null));
                 $error->setIsMissingFieldError(true);
                 $errors[] = $error;
             }
             break;
         case PhabricatorTransactions::TYPE_EDGE:
             foreach ($xactions as $xaction) {
                 switch ($xaction->getMetadataValue('edge:type')) {
                     case PhortuneAccountHasMemberEdgeType::EDGECONST:
                         // TODO: This is a bit cumbersome, but validation happens before
                         // transaction normalization. Maybe provide a cleaner attack on
                         // this eventually? There's no way to generate "+" or "-"
                         // transactions right now.
                         $new = $xaction->getNewValue();
                         $set = idx($new, '=', array());
                         if (empty($set[$this->requireActor()->getPHID()])) {
                             $error = new PhabricatorApplicationTransactionValidationError($type, pht('Invalid'), pht('You can not remove yourself as an account member.'), $xaction);
                             $errors[] = $error;
                         }
                         break;
                 }
             }
             break;
     }
     return $errors;
 }
开发者ID:pugong,项目名称:phabricator,代码行数:33,代码来源:PhortuneAccountEditor.php

示例10: validateTransaction

 protected function validateTransaction(PhabricatorLiskDAO $object, $type, array $xactions)
 {
     $errors = parent::validateTransaction($object, $type, $xactions);
     switch ($type) {
         case PhabricatorOAuthServerTransaction::TYPE_NAME:
             $missing = $this->validateIsEmptyTextField($object->getName(), $xactions);
             if ($missing) {
                 $error = new PhabricatorApplicationTransactionValidationError($type, pht('Required'), pht('OAuth applications must have a name.'), nonempty(last($xactions), null));
                 $error->setIsMissingFieldError(true);
                 $errors[] = $error;
             }
             break;
         case PhabricatorOAuthServerTransaction::TYPE_REDIRECT_URI:
             $missing = $this->validateIsEmptyTextField($object->getRedirectURI(), $xactions);
             if ($missing) {
                 $error = new PhabricatorApplicationTransactionValidationError($type, pht('Required'), pht('OAuth applications must have a valid redirect URI.'), nonempty(last($xactions), null));
                 $error->setIsMissingFieldError(true);
                 $errors[] = $error;
             } else {
                 foreach ($xactions as $xaction) {
                     $redirect_uri = $xaction->getNewValue();
                     try {
                         $server = new PhabricatorOAuthServer();
                         $server->assertValidRedirectURI($redirect_uri);
                     } catch (Exception $ex) {
                         $errors[] = new PhabricatorApplicationTransactionValidationError($type, pht('Invalid'), $ex->getMessage(), $xaction);
                     }
                 }
             }
             break;
     }
     return $errors;
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:33,代码来源:PhabricatorOAuthServerEditor.php

示例11: applyCustomExternalTransaction

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

示例12: applyCustomExternalTransaction

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

示例13: getTransactionTypes

 public function getTransactionTypes()
 {
     $types = parent::getTransactionTypes();
     $types[] = PhabricatorTransactions::TYPE_VIEW_POLICY;
     $types[] = PhabricatorTransactions::TYPE_EDIT_POLICY;
     $types[] = DrydockBlueprintTransaction::TYPE_NAME;
     return $types;
 }
开发者ID:fengshao0907,项目名称:phabricator,代码行数:8,代码来源:DrydockBlueprintEditor.php

示例14: 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

示例15: applyCustomExternalTransaction

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


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