本文整理汇总了PHP中PhabricatorPHID类的典型用法代码示例。如果您正苦于以下问题:PHP PhabricatorPHID类的具体用法?PHP PhabricatorPHID怎么用?PHP PhabricatorPHID使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PhabricatorPHID类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testTransactionRollback
public function testTransactionRollback()
{
$check = array();
$phid = new PhabricatorPHID();
$phid->openTransaction();
for ($ii = 0; $ii < 3; $ii++) {
$test_phid = $this->generateTestPHID();
$obj = new PhabricatorPHID();
$obj->setPHID($test_phid);
$obj->setPHIDType('TEST');
$obj->setOwnerPHID('PHID-UNIT-!!!!');
$obj->save();
$check[] = $test_phid;
}
$phid->killTransaction();
foreach ($check as $test_phid) {
$this->assertNoSuchPHID($test_phid);
}
}
示例2: createBasicDummyHandle
protected function createBasicDummyHandle($name, $type, $fullname = null, $uri = null)
{
$id = mt_rand(15, 9999);
$handle = new PhabricatorObjectHandle();
$handle->setName($name);
$handle->setType($type);
$handle->setPHID(PhabricatorPHID::generateNewPHID($type));
if ($fullname) {
$handle->setFullName($fullname);
} else {
$handle->setFullName(sprintf('%s%d: %s', substr($type, 0, 1), $id, $name));
}
if ($uri) {
$handle->setURI($uri);
}
return $handle;
}
示例3: execute
protected function execute(ConduitAPIRequest $request)
{
$names = $request->getValue('names');
$phids = array();
foreach ($names as $name) {
$phid = PhabricatorPHID::fromObjectName($name);
if ($phid) {
$phids[$name] = $phid;
}
}
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles();
$result = array();
foreach ($phids as $name => $phid) {
if (isset($handles[$phid]) && $handles[$phid]->isComplete()) {
$result[$name] = $this->buildHandleInformationDictionary($handles[$phid]);
}
}
return $result;
}
示例4: generateNewPHID
public static function generateNewPHID($type, array $config = array())
{
$owner = idx($config, 'owner');
$parent = idx($config, 'parent');
if (!$type) {
throw new Exception("Can not generate PHID with no type.");
}
$uniq = Filesystem::readRandomCharacters(20);
$phid = 'PHID-' . $type . '-' . $uniq;
$phid_rec = new PhabricatorPHID();
$phid_rec->setPHIDType($type);
$phid_rec->setOwnerPHID($owner);
$phid_rec->setParentPHID($parent);
$phid_rec->setPHID($phid);
$phid_rec->save();
return $phid;
}
示例5: save
public function save()
{
$this->subscriptionClassKey = PhabricatorHash::digestForIndex($this->subscriptionClass);
$this->subscriptionRefKey = PhabricatorHash::digestForIndex($this->subscriptionRef);
$is_new = !$this->getID();
$this->openTransaction();
// If we're saving this subscription for the first time, we're also
// going to set up the trigger for it.
if ($is_new) {
$trigger_phid = PhabricatorPHID::generateNewPHID(PhabricatorWorkerTriggerPHIDType::TYPECONST);
$this->setTriggerPHID($trigger_phid);
}
$result = parent::save();
if ($is_new) {
$trigger_action = new PhabricatorScheduleTaskTriggerAction(array('class' => 'PhortuneSubscriptionWorker', 'data' => array('subscriptionPHID' => $this->getPHID()), 'options' => array('objectPHID' => $this->getPHID(), 'priority' => PhabricatorWorker::PRIORITY_BULK)));
$trigger = $this->getTrigger();
$trigger->setPHID($trigger_phid);
$trigger->setAction($trigger_action);
$trigger->save();
}
$this->saveTransaction();
return $result;
}
示例6: generatePHID
public function generatePHID()
{
return PhabricatorPHID::generateNewPHID(PhabricatorRepositoryRepositoryPHIDType::TYPECONST);
}
示例7: generatePHID
public function generatePHID()
{
return PhabricatorPHID::generateNewPHID(PhabricatorOwnersPackagePHIDType::TYPECONST);
}
示例8: generatePHID
public function generatePHID()
{
return PhabricatorPHID::generateNewPHID(DrydockRepositoryOperationPHIDType::TYPECONST);
}
示例9: generatePHID
public function generatePHID()
{
return PhabricatorPHID::generateNewPHID(PhabricatorDashboardPanelPHIDType::TYPECONST);
}
示例10: generatePHID
public function generatePHID()
{
return PhabricatorPHID::generateNewPHID(DrydockLeasePHIDType::TYPECONST);
}
示例11: generatePHID
public function generatePHID()
{
return PhabricatorPHID::generateNewPHID(PhabricatorConfigConfigPHIDType::TYPECONST);
}
示例12: id
$conn_w = id(new DifferentialRevision())->establishConnection('w');
$rows = new LiskRawMigrationIterator($conn_w, 'differential_comment');
$content_source = PhabricatorContentSource::newForSource(PhabricatorContentSource::SOURCE_LEGACY, array())->serialize();
echo pht('Migrating Differential comment text to modern storage...') . "\n";
foreach ($rows as $row) {
$id = $row['id'];
echo pht('Migrating Differential comment %d...', $id) . "\n";
if (!strlen($row['content'])) {
echo pht('Comment has no text, continuing.') . "\n";
continue;
}
$revision = id(new DifferentialRevision())->load($row['revisionID']);
if (!$revision) {
echo pht('Comment has no valid revision, continuing.') . "\n";
continue;
}
$revision_phid = $revision->getPHID();
$dst_table = 'differential_inline_comment';
$xaction_phid = PhabricatorPHID::generateNewPHID(PhabricatorApplicationTransactionTransactionPHIDType::TYPECONST, DifferentialRevisionPHIDType::TYPECONST);
$comment_phid = PhabricatorPHID::generateNewPHID(PhabricatorPHIDConstants::PHID_TYPE_XCMT, DifferentialRevisionPHIDType::TYPECONST);
queryfx($conn_w, 'INSERT IGNORE INTO %T
(phid, transactionPHID, authorPHID, viewPolicy, editPolicy,
commentVersion, content, contentSource, isDeleted,
dateCreated, dateModified, revisionPHID, changesetID,
legacyCommentID)
VALUES (%s, %s, %s, %s, %s,
%d, %s, %s, %d,
%d, %d, %s, %nd,
%d)', 'differential_transaction_comment', $comment_phid, $xaction_phid, $row['authorPHID'], 'public', $row['authorPHID'], 1, $row['content'], $content_source, 0, $row['dateCreated'], $row['dateModified'], $revision_phid, null, $row['id']);
}
echo pht('Done.') . "\n";
示例13: foreach
}
// Build the main comment transaction.
foreach ($main_comments as $main) {
$xactions[] = array('type' => PhabricatorTransactions::TYPE_COMMENT, 'old' => null, 'new' => null, 'phid' => $main['transactionPHID'], 'comment' => $main);
}
// Build inline comment transactions.
foreach ($inline_comments as $inline) {
$xactions[] = array('type' => PhabricatorAuditActionConstants::INLINE, 'old' => null, 'new' => null, 'phid' => $inline['transactionPHID'], 'comment' => $inline);
}
foreach ($xactions as $xaction) {
// Generate a new PHID, if we don't already have one from the comment
// table. We pregenerated into the comment table to make this a little
// easier, so we only need to write to one table.
$xaction_phid = idx($xaction, 'phid');
if (!$xaction_phid) {
$xaction_phid = PhabricatorPHID::generateNewPHID(PhabricatorApplicationTransactionTransactionPHIDType::TYPECONST, PhabricatorRepositoryCommitPHIDType::TYPECONST);
}
unset($xaction['phid']);
$comment_phid = null;
$comment_version = 0;
if (idx($xaction, 'comment')) {
$comment_phid = $xaction['comment']['phid'];
$comment_version = 1;
}
$old = idx($xaction, 'old');
$new = idx($xaction, 'new');
$meta = idx($xaction, 'meta', array());
queryfx($conn_w, 'INSERT INTO %T (phid, authorPHID, objectPHID, viewPolicy, editPolicy,
commentPHID, commentVersion, transactionType, oldValue, newValue,
contentSource, metadata, dateCreated, dateModified)
VALUES (%s, %s, %s, %s, %s, %ns, %d, %s, %ns, %ns, %s, %s, %d, %d)', 'audit_transaction', $xaction_phid, $row['actorPHID'], $row['targetPHID'], 'public', $row['actorPHID'], $comment_phid, $comment_version, $xaction['type'], json_encode($old), json_encode($new), $content_source, json_encode($meta), $row['dateCreated'], $row['dateModified']);
示例14: generatePHID
public function generatePHID()
{
return PhabricatorPHID::generateNewPHID(PhabricatorOAuthServerClientPHIDType::TYPECONST);
}
示例15: generatePHID
public function generatePHID()
{
return PhabricatorPHID::generateNewPHID(PhabricatorPeopleExternalPHIDType::TYPECONST);
}