当前位置: 首页>>代码示例>>PHP>>正文


PHP PhabricatorRepository::shouldPublish方法代码示例

本文整理汇总了PHP中PhabricatorRepository::shouldPublish方法的典型用法代码示例。如果您正苦于以下问题:PHP PhabricatorRepository::shouldPublish方法的具体用法?PHP PhabricatorRepository::shouldPublish怎么用?PHP PhabricatorRepository::shouldPublish使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PhabricatorRepository的用法示例。


在下文中一共展示了PhabricatorRepository::shouldPublish方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: triggerOwnerAudits

 private function triggerOwnerAudits(PhabricatorRepository $repository, PhabricatorRepositoryCommit $commit)
 {
     if (!$repository->shouldPublish()) {
         return;
     }
     $affected_paths = PhabricatorOwnerPathQuery::loadAffectedPaths($repository, $commit, PhabricatorUser::getOmnipotentUser());
     $affected_packages = PhabricatorOwnersPackage::loadAffectedPackages($repository, $affected_paths);
     if (!$affected_packages) {
         return;
     }
     $data = id(new PhabricatorRepositoryCommitData())->loadOneWhere('commitID = %d', $commit->getID());
     $commit->attachCommitData($data);
     $author_phid = $data->getCommitDetail('authorPHID');
     $revision_id = $data->getCommitDetail('differential.revisionID');
     if ($revision_id) {
         $revision = id(new DifferentialRevisionQuery())->setViewer(PhabricatorUser::getOmnipotentUser())->withIDs(array($revision_id))->needReviewerStatus(true)->executeOne();
     } else {
         $revision = null;
     }
     $requests = id(new PhabricatorRepositoryAuditRequest())->loadAllWhere('commitPHID = %s', $commit->getPHID());
     $requests = mpull($requests, null, 'getAuditorPHID');
     foreach ($affected_packages as $package) {
         $request = idx($requests, $package->getPHID());
         if ($request) {
             // Don't update request if it exists already.
             continue;
         }
         if ($package->isArchived()) {
             // Don't trigger audits if the package is archived.
             continue;
         }
         if ($package->getAuditingEnabled()) {
             $reasons = $this->checkAuditReasons($commit, $package, $author_phid, $revision);
             if ($reasons) {
                 $audit_status = PhabricatorAuditStatusConstants::AUDIT_REQUIRED;
             } else {
                 $audit_status = PhabricatorAuditStatusConstants::AUDIT_NOT_REQUIRED;
             }
         } else {
             $reasons = array();
             $audit_status = PhabricatorAuditStatusConstants::NONE;
         }
         $relationship = new PhabricatorRepositoryAuditRequest();
         $relationship->setAuditorPHID($package->getPHID());
         $relationship->setCommitPHID($commit->getPHID());
         $relationship->setAuditReasons($reasons);
         $relationship->setAuditStatus($audit_status);
         $relationship->save();
         $requests[$package->getPHID()] = $relationship;
     }
     $commit->updateAuditStatus($requests);
     $commit->save();
 }
开发者ID:vinzent,项目名称:phabricator,代码行数:53,代码来源:PhabricatorRepositoryCommitOwnersWorker.php

示例2: triggerOwnerAudits

 private function triggerOwnerAudits(PhabricatorRepository $repository, PhabricatorRepositoryCommit $commit)
 {
     if (!$repository->shouldPublish()) {
         return;
     }
     $affected_paths = PhabricatorOwnerPathQuery::loadAffectedPaths($repository, $commit, PhabricatorUser::getOmnipotentUser());
     $affected_packages = PhabricatorOwnersPackage::loadAffectedPackages($repository, $affected_paths);
     if ($affected_packages) {
         $requests = id(new PhabricatorRepositoryAuditRequest())->loadAllWhere('commitPHID = %s', $commit->getPHID());
         $requests = mpull($requests, null, 'getAuditorPHID');
         foreach ($affected_packages as $package) {
             $request = idx($requests, $package->getPHID());
             if ($request) {
                 // Don't update request if it exists already.
                 continue;
             }
             if ($package->getAuditingEnabled()) {
                 $reasons = $this->checkAuditReasons($commit, $package);
                 if ($reasons) {
                     $audit_status = PhabricatorAuditStatusConstants::AUDIT_REQUIRED;
                 } else {
                     $audit_status = PhabricatorAuditStatusConstants::AUDIT_NOT_REQUIRED;
                 }
             } else {
                 $reasons = array();
                 $audit_status = PhabricatorAuditStatusConstants::NONE;
             }
             $relationship = new PhabricatorRepositoryAuditRequest();
             $relationship->setAuditorPHID($package->getPHID());
             $relationship->setCommitPHID($commit->getPHID());
             $relationship->setAuditReasons($reasons);
             $relationship->setAuditStatus($audit_status);
             $relationship->save();
             $requests[$package->getPHID()] = $relationship;
         }
         $commit->updateAuditStatus($requests);
         $commit->save();
     }
 }
开发者ID:pugong,项目名称:phabricator,代码行数:39,代码来源:PhabricatorRepositoryCommitOwnersWorker.php


注:本文中的PhabricatorRepository::shouldPublish方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。