[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/repository/storage/ -> PhabricatorRepositoryPushEvent.php (source)

   1  <?php
   2  
   3  /**
   4   * Groups a set of push logs corresponding to changes which were all pushed in
   5   * the same transaction.
   6   */
   7  final class PhabricatorRepositoryPushEvent
   8    extends PhabricatorRepositoryDAO
   9    implements PhabricatorPolicyInterface {
  10  
  11    protected $repositoryPHID;
  12    protected $epoch;
  13    protected $pusherPHID;
  14    protected $remoteAddress;
  15    protected $remoteProtocol;
  16    protected $rejectCode;
  17    protected $rejectDetails;
  18  
  19    private $repository = self::ATTACHABLE;
  20    private $logs = self::ATTACHABLE;
  21  
  22    public static function initializeNewEvent(PhabricatorUser $viewer) {
  23      return id(new PhabricatorRepositoryPushEvent())
  24        ->setPusherPHID($viewer->getPHID());
  25    }
  26  
  27    public function getConfiguration() {
  28      return array(
  29        self::CONFIG_AUX_PHID => true,
  30        self::CONFIG_TIMESTAMPS => false,
  31        self::CONFIG_COLUMN_SCHEMA => array(
  32          'remoteAddress' => 'uint32?',
  33          'remoteProtocol' => 'text32?',
  34          'rejectCode' => 'uint32',
  35          'rejectDetails' => 'text64?',
  36        ),
  37        self::CONFIG_KEY_SCHEMA => array(
  38          'key_repository' => array(
  39            'columns' => array('repositoryPHID'),
  40          ),
  41        ),
  42      ) + parent::getConfiguration();
  43    }
  44  
  45    public function generatePHID() {
  46      return PhabricatorPHID::generateNewPHID(
  47        PhabricatorRepositoryPushEventPHIDType::TYPECONST);
  48    }
  49  
  50    public function attachRepository(PhabricatorRepository $repository) {
  51      $this->repository = $repository;
  52      return $this;
  53    }
  54  
  55    public function getRepository() {
  56      return $this->assertAttached($this->repository);
  57    }
  58  
  59    public function attachLogs(array $logs) {
  60      $this->logs = $logs;
  61      return $this;
  62    }
  63  
  64    public function getLogs() {
  65      return $this->assertAttached($this->logs);
  66    }
  67  
  68  
  69  /* -(  PhabricatorPolicyInterface  )----------------------------------------- */
  70  
  71  
  72    public function getCapabilities() {
  73      return array(
  74        PhabricatorPolicyCapability::CAN_VIEW,
  75      );
  76    }
  77  
  78    public function getPolicy($capability) {
  79      return $this->getRepository()->getPolicy($capability);
  80    }
  81  
  82    public function hasAutomaticCapability($capability, PhabricatorUser $viewer) {
  83      return $this->getRepository()->hasAutomaticCapability($capability, $viewer);
  84    }
  85  
  86    public function describeAutomaticCapability($capability) {
  87      return pht(
  88        "A repository's push events are visible to users who can see the ".
  89        "repository.");
  90    }
  91  
  92  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1