[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * A message sent to an executing build target by an external system. We 5 * capture these messages and process them asynchronously to avoid race 6 * conditions where we receive a message before a build plan is ready to 7 * accept it. 8 */ 9 final class HarbormasterBuildMessage extends HarbormasterDAO 10 implements PhabricatorPolicyInterface { 11 12 protected $authorPHID; 13 protected $buildTargetPHID; 14 protected $type; 15 protected $isConsumed; 16 17 private $buildTarget = self::ATTACHABLE; 18 19 public static function initializeNewMessage(PhabricatorUser $actor) { 20 return id(new HarbormasterBuildMessage()) 21 ->setAuthorPHID($actor->getPHID()) 22 ->setIsConsumed(0); 23 } 24 25 public function getConfiguration() { 26 return array( 27 self::CONFIG_COLUMN_SCHEMA => array( 28 'type' => 'text16', 29 'isConsumed' => 'bool', 30 ), 31 self::CONFIG_KEY_SCHEMA => array( 32 'key_buildtarget' => array( 33 'columns' => array('buildTargetPHID'), 34 ), 35 ), 36 ) + parent::getConfiguration(); 37 } 38 39 public function getBuildTarget() { 40 return $this->assertAttached($this->buildTarget); 41 } 42 43 public function attachBuildTarget(HarbormasterBuildTarget $target) { 44 $this->buildTarget = $target; 45 return $this; 46 } 47 48 49 /* -( PhabricatorPolicyInterface )----------------------------------------- */ 50 51 52 public function getCapabilities() { 53 return array( 54 PhabricatorPolicyCapability::CAN_VIEW, 55 ); 56 } 57 58 public function getPolicy($capability) { 59 return $this->getBuildTarget()->getPolicy($capability); 60 } 61 62 public function hasAutomaticCapability($capability, PhabricatorUser $viewer) { 63 return $this->getBuildTarget()->hasAutomaticCapability( 64 $capability, 65 $viewer); 66 } 67 68 public function describeAutomaticCapability($capability) { 69 return pht('Build messages have the same policies as their targets.'); 70 } 71 72 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |