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; }
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; }
public function generatePHID() { return PhabricatorPHID::generateNewPHID('HLXS'); }
public function generatePHID() { return PhabricatorPHID::generateNewPHID(PhortuneMerchantPHIDType::TYPECONST); }
public function generatePHID() { return PhabricatorPHID::generateNewPHID(PhabricatorPHIDConstants::PHID_TYPE_AUTH); }
public function generatePHID() { return PhabricatorPHID::generateNewPHID(HarbormasterBuildPlanPHIDType::TYPECONST); }
public function generatePHID() { return PhabricatorPHID::generateNewPHID(PonderQuestionPHIDType::TYPECONST); }
public function generatePHID() { return PhabricatorPHID::generateNewPHID(HeraldRulePHIDType::TYPECONST); }
} // 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']);
public function generatePHID() { return PhabricatorPHID::generateNewPHID(PhabricatorOAuthServerClientPHIDType::TYPECONST); }
public function generatePHID() { return PhabricatorPHID::generateNewPHID(PhabricatorPeopleExternalPHIDType::TYPECONST); }
<?php $audit_table = new PhabricatorAuditTransaction(); $conn_w = $audit_table->establishConnection('w'); $conn_w->openTransaction(); $src_table = 'audit_inlinecomment'; $dst_table = 'audit_transaction_comment'; echo pht('Migrating Audit inline comments to new format...') . "\n"; $content_source = PhabricatorContentSource::newForSource(PhabricatorContentSource::SOURCE_LEGACY, array())->serialize(); $rows = new LiskRawMigrationIterator($conn_w, $src_table); foreach ($rows as $row) { $id = $row['id']; echo pht('Migrating inline #%d...', $id); if ($row['auditCommentID']) { $xaction_phid = PhabricatorPHID::generateNewPHID(PhabricatorApplicationTransactionTransactionPHIDType::TYPECONST, PhabricatorRepositoryCommitPHIDType::TYPECONST); } else { $xaction_phid = null; } $comment_phid = PhabricatorPHID::generateNewPHID(PhabricatorPHIDConstants::PHID_TYPE_XCMT, PhabricatorRepositoryCommitPHIDType::TYPECONST); queryfx($conn_w, 'INSERT IGNORE INTO %T (id, phid, transactionPHID, authorPHID, viewPolicy, editPolicy, commentVersion, content, contentSource, isDeleted, dateCreated, dateModified, commitPHID, pathID, isNewFile, lineNumber, lineLength, hasReplies, legacyCommentID) VALUES (%d, %s, %ns, %s, %s, %s, %d, %s, %s, %d, %d, %d, %s, %nd, %d, %d, %d, %d, %nd)', $dst_table, $row['id'], $comment_phid, $xaction_phid, $row['authorPHID'], 'public', $row['authorPHID'], 1, $row['content'], $content_source, 0, $row['dateCreated'], $row['dateModified'], $row['commitPHID'], $row['pathID'], $row['isNewFile'], $row['lineNumber'], $row['lineLength'], 0, $row['auditCommentID']); } $conn_w->saveTransaction(); echo pht('Done.') . "\n";
public function generatePHID() { return PhabricatorPHID::generateNewPHID(DifferentialRevisionPHIDType::TYPECONST); }
public function generatePHID() { return PhabricatorPHID::generateNewPHID(PhabricatorEditEngineConfigurationPHIDType::TYPECONST); }
public function generatePHID() { return PhabricatorPHID::generateNewPHID(DivinerBookPHIDType::TYPECONST); }
public function generatePHID() { return PhabricatorPHID::generateNewPHID(AlmanacNetworkPHIDType::TYPECONST); }
public function generatePHID() { return PhabricatorPHID::generateNewPHID(PhrictionDocumentPHIDType::TYPECONST); }
$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";
public function generatePHID() { return PhabricatorPHID::generateNewPHID(PhabricatorConfigConfigPHIDType::TYPECONST); }
public function generatePHID() { $type = PhabricatorApplicationTransactionTransactionPHIDType::TYPECONST; $subtype = $this->getApplicationTransactionType(); return PhabricatorPHID::generateNewPHID($type, $subtype); }
public function generatePHID() { return PhabricatorPHID::generateNewPHID(DrydockLeasePHIDType::TYPECONST); }
public function generatePHID() { return PhabricatorPHID::generateNewPHID(NuanceSourcePHIDType::TYPECONST); }
public function generatePHID() { return PhabricatorPHID::generateNewPHID(PhabricatorDashboardPanelPHIDType::TYPECONST); }
public function generatePHID() { return PhabricatorPHID::generateNewPHID(PhabricatorProjectProjectPHIDType::TYPECONST); }
public function generatePHID() { return PhabricatorPHID::generateNewPHID(DrydockRepositoryOperationPHIDType::TYPECONST); }
<?php $diff_table = new DifferentialDiff(); $conn_w = $diff_table->establishConnection('w'); $size = 1000; $row_iter = id(new LiskMigrationIterator($diff_table))->setPageSize($size); $chunk_iter = new PhutilChunkedIterator($row_iter, $size); foreach ($chunk_iter as $chunk) { $sql = array(); foreach ($chunk as $diff) { $id = $diff->getID(); echo pht('Migrating diff ID %d...', $id) . "\n"; $phid = $diff->getPHID(); if (strlen($phid)) { continue; } $type_diff = DifferentialDiffPHIDType::TYPECONST; $new_phid = PhabricatorPHID::generateNewPHID($type_diff); $sql[] = qsprintf($conn_w, '(%d, %s)', $id, $new_phid); } if (!$sql) { continue; } foreach (PhabricatorLiskDAO::chunkSQL($sql, ', ') as $sql_chunk) { queryfx($conn_w, 'INSERT IGNORE INTO %T (id, phid) VALUES %Q ON DUPLICATE KEY UPDATE phid = VALUES(phid)', $diff_table->getTableName(), $sql_chunk); } } echo pht('Done.') . "\n";
public function generatePHID() { return PhabricatorPHID::generateNewPHID(PhabricatorOwnersPackagePHIDType::TYPECONST); }
public function setAuditCommentID($id) { $this->proxy->setLegacyCommentID($id); $this->proxy->setTransactionPHID(PhabricatorPHID::generateNewPHID(PhabricatorApplicationTransactionTransactionPHIDType::TYPECONST, PhabricatorRepositoryCommitPHIDType::TYPECONST)); return $this; }
public function generatePHID() { return PhabricatorPHID::generateNewPHID(PhabricatorRepositoryRepositoryPHIDType::TYPECONST); }
public function generatePHID() { return PhabricatorPHID::generateNewPHID(DoorkeeperExternalObjectPHIDType::TYPECONST); }