本文整理汇总了PHP中PhabricatorLiskDAO::getRepository方法的典型用法代码示例。如果您正苦于以下问题:PHP PhabricatorLiskDAO::getRepository方法的具体用法?PHP PhabricatorLiskDAO::getRepository怎么用?PHP PhabricatorLiskDAO::getRepository使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhabricatorLiskDAO
的用法示例。
在下文中一共展示了PhabricatorLiskDAO::getRepository方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildMailTemplate
protected function buildMailTemplate(PhabricatorLiskDAO $object)
{
$identifier = $object->getCommitIdentifier();
$repository = $object->getRepository();
$monogram = $repository->getMonogram();
$summary = $object->getSummary();
$name = $repository->formatCommitName($identifier);
$subject = "{$name}: {$summary}";
$thread_topic = "Commit {$monogram}{$identifier}";
return id(new PhabricatorMetaMTAMail())->setSubject($subject)->addHeader('Thread-Topic', $thread_topic);
}
示例2: shouldPublishRepositoryActivity
private function shouldPublishRepositoryActivity(PhabricatorLiskDAO $object, array $xactions)
{
// not every code path loads the repository so tread carefully
// TODO: They should, and then we should simplify this.
$repository = $object->getRepository($assert_attached = false);
if ($repository != PhabricatorLiskDAO::ATTACHABLE) {
if (!$repository->shouldPublish()) {
return false;
}
}
return $this->isCommitMostlyImported($object);
}
示例3: didApplyHeraldRules
protected function didApplyHeraldRules(PhabricatorLiskDAO $object, HeraldAdapter $adapter, HeraldTranscript $transcript)
{
$repository = $object->getRepository();
if (!$repository) {
return array();
}
if (!$this->affectedPaths) {
return array();
}
$packages = PhabricatorOwnersPackage::loadAffectedPackages($repository, $this->affectedPaths);
if (!$packages) {
return array();
}
// Remove packages that the revision author is an owner of. If you own
// code, you don't need another owner to review it.
$authority = id(new PhabricatorOwnersPackageQuery())->setViewer(PhabricatorUser::getOmnipotentUser())->withPHIDs(mpull($packages, 'getPHID'))->withAuthorityPHIDs(array($object->getAuthorPHID()))->execute();
$authority = mpull($authority, null, 'getPHID');
foreach ($packages as $key => $package) {
$package_phid = $package->getPHID();
if (isset($authority[$package_phid])) {
unset($packages[$key]);
continue;
}
}
if (!$packages) {
return array();
}
$auto_subscribe = array();
$auto_review = array();
$auto_block = array();
foreach ($packages as $package) {
switch ($package->getAutoReview()) {
case PhabricatorOwnersPackage::AUTOREVIEW_SUBSCRIBE:
$auto_subscribe[] = $package;
break;
case PhabricatorOwnersPackage::AUTOREVIEW_REVIEW:
$auto_review[] = $package;
break;
case PhabricatorOwnersPackage::AUTOREVIEW_BLOCK:
$auto_block[] = $package;
break;
case PhabricatorOwnersPackage::AUTOREVIEW_NONE:
default:
break;
}
}
$owners_phid = id(new PhabricatorOwnersApplication())->getPHID();
$xactions = array();
if ($auto_subscribe) {
$xactions[] = $object->getApplicationTransactionTemplate()->setAuthorPHID($owners_phid)->setTransactionType(PhabricatorTransactions::TYPE_SUBSCRIBERS)->setNewValue(array('+' => mpull($auto_subscribe, 'getPHID')));
}
$specs = array(array($auto_review, false), array($auto_block, true));
foreach ($specs as $spec) {
list($reviewers, $blocking) = $spec;
if (!$reviewers) {
continue;
}
$phids = mpull($reviewers, 'getPHID');
$xaction = $this->newAutoReviewTransaction($object, $phids, $blocking);
if ($xaction) {
$xactions[] = $xaction;
}
}
return $xactions;
}
示例4: applyFinalEffects
protected function applyFinalEffects(PhabricatorLiskDAO $object, array $xactions)
{
// Synchronize the repository state based on the presence of an "Observe"
// URI.
$repository = $object->getRepository();
$uris = id(new PhabricatorRepositoryURIQuery())->setViewer(PhabricatorUser::getOmnipotentUser())->withRepositories(array($repository))->execute();
$observe_uri = null;
foreach ($uris as $uri) {
if ($uri->getIoType() != PhabricatorRepositoryURI::IO_OBSERVE) {
continue;
}
$observe_uri = $uri;
break;
}
$was_hosted = $repository->isHosted();
if ($observe_uri) {
$repository->setHosted(false)->setDetail('remote-uri', (string) $observe_uri->getEffectiveURI())->setCredentialPHID($observe_uri->getCredentialPHID());
} else {
$repository->setHosted(true)->setDetail('remote-uri', null)->setCredentialPHID(null);
}
$repository->save();
$is_hosted = $repository->isHosted();
// If we've swapped the repository from hosted to observed or vice versa,
// reset all the cluster version clocks.
if ($was_hosted != $is_hosted) {
$cluster_engine = id(new DiffusionRepositoryClusterEngine())->setViewer($this->getActor())->setRepository($repository)->synchronizeWorkingCopyAfterHostingChange();
}
return $xactions;
}