Changeset View
Changeset View
Standalone View
Standalone View
src/applications/repository/storage/PhabricatorRepositoryCommit.php
Show All 19 Lines | implements | ||||
PhabricatorDraftInterface { | PhabricatorDraftInterface { | ||||
protected $repositoryID; | protected $repositoryID; | ||||
protected $phid; | protected $phid; | ||||
protected $authorIdentityPHID; | protected $authorIdentityPHID; | ||||
protected $committerIdentityPHID; | protected $committerIdentityPHID; | ||||
protected $commitIdentifier; | protected $commitIdentifier; | ||||
protected $epoch; | protected $epoch; | ||||
protected $mailKey; | |||||
protected $authorPHID; | protected $authorPHID; | ||||
protected $auditStatus = DiffusionCommitAuditStatus::NONE; | protected $auditStatus = DiffusionCommitAuditStatus::NONE; | ||||
protected $summary = ''; | protected $summary = ''; | ||||
protected $importStatus = 0; | protected $importStatus = 0; | ||||
const IMPORTED_MESSAGE = 1; | const IMPORTED_MESSAGE = 1; | ||||
const IMPORTED_CHANGE = 2; | const IMPORTED_CHANGE = 2; | ||||
const IMPORTED_OWNERS = 4; | const IMPORTED_OWNERS = 4; | ||||
▲ Show 20 Lines • Show All 74 Lines • ▼ Show 20 Lines | final class PhabricatorRepositoryCommit | ||||
} | } | ||||
protected function getConfiguration() { | protected function getConfiguration() { | ||||
return array( | return array( | ||||
self::CONFIG_AUX_PHID => true, | self::CONFIG_AUX_PHID => true, | ||||
self::CONFIG_TIMESTAMPS => false, | self::CONFIG_TIMESTAMPS => false, | ||||
self::CONFIG_COLUMN_SCHEMA => array( | self::CONFIG_COLUMN_SCHEMA => array( | ||||
'commitIdentifier' => 'text40', | 'commitIdentifier' => 'text40', | ||||
'mailKey' => 'bytes20', | |||||
'authorPHID' => 'phid?', | 'authorPHID' => 'phid?', | ||||
'authorIdentityPHID' => 'phid?', | 'authorIdentityPHID' => 'phid?', | ||||
'committerIdentityPHID' => 'phid?', | 'committerIdentityPHID' => 'phid?', | ||||
'auditStatus' => 'text32', | 'auditStatus' => 'text32', | ||||
'summary' => 'text255', | 'summary' => 'text255', | ||||
'importStatus' => 'uint32', | 'importStatus' => 'uint32', | ||||
), | ), | ||||
self::CONFIG_KEY_SCHEMA => array( | self::CONFIG_KEY_SCHEMA => array( | ||||
▲ Show 20 Lines • Show All 188 Lines • ▼ Show 20 Lines | public function writeOwnersEdges(array $package_phids) { | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getAuditorPHIDsForEdit() { | public function getAuditorPHIDsForEdit() { | ||||
$audits = $this->getAudits(); | $audits = $this->getAudits(); | ||||
return mpull($audits, 'getAuditorPHID'); | return mpull($audits, 'getAuditorPHID'); | ||||
} | } | ||||
public function save() { | |||||
if (!$this->mailKey) { | |||||
$this->mailKey = Filesystem::readRandomCharacters(20); | |||||
} | |||||
return parent::save(); | |||||
} | |||||
public function delete() { | public function delete() { | ||||
$data = $this->loadCommitData(); | $data = $this->loadCommitData(); | ||||
$audits = id(new PhabricatorRepositoryAuditRequest()) | $audits = id(new PhabricatorRepositoryAuditRequest()) | ||||
->loadAllWhere('commitPHID = %s', $this->getPHID()); | ->loadAllWhere('commitPHID = %s', $this->getPHID()); | ||||
$this->openTransaction(); | $this->openTransaction(); | ||||
if ($data) { | if ($data) { | ||||
$data->delete(); | $data->delete(); | ||||
▲ Show 20 Lines • Show All 261 Lines • ▼ Show 20 Lines | /* -( Stuff for serialization )---------------------------------------------- */ | ||||
* done, as well as complexity of the other fields. | * done, as well as complexity of the other fields. | ||||
*/ | */ | ||||
public function toDictionary() { | public function toDictionary() { | ||||
return array( | return array( | ||||
'repositoryID' => $this->getRepositoryID(), | 'repositoryID' => $this->getRepositoryID(), | ||||
'phid' => $this->getPHID(), | 'phid' => $this->getPHID(), | ||||
'commitIdentifier' => $this->getCommitIdentifier(), | 'commitIdentifier' => $this->getCommitIdentifier(), | ||||
'epoch' => $this->getEpoch(), | 'epoch' => $this->getEpoch(), | ||||
'mailKey' => $this->getMailKey(), | |||||
'authorPHID' => $this->getAuthorPHID(), | 'authorPHID' => $this->getAuthorPHID(), | ||||
'auditStatus' => $this->getAuditStatus(), | 'auditStatus' => $this->getAuditStatus(), | ||||
'summary' => $this->getSummary(), | 'summary' => $this->getSummary(), | ||||
'importStatus' => $this->getImportStatus(), | 'importStatus' => $this->getImportStatus(), | ||||
); | ); | ||||
} | } | ||||
public static function newFromDictionary(array $dict) { | public static function newFromDictionary(array $dict) { | ||||
▲ Show 20 Lines • Show All 365 Lines • Show Last 20 Lines |