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


PHP DiffusionRequest::newFromAphrontRequestDictionary方法代码示例

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


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

示例1: willProcessRequest

 public function willProcessRequest(array $data)
 {
     if (isset($data['callsign'])) {
         $drequest = DiffusionRequest::newFromAphrontRequestDictionary($data);
         $this->diffusionRequest = $drequest;
     }
 }
开发者ID:rudimk,项目名称:phabricator,代码行数:7,代码来源:DiffusionController.php

示例2: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $repository_phid = $request->getStr('repositoryPHID');
     $repository = id(new PhabricatorRepository())->loadOneWhere('phid = %s', $repository_phid);
     if (!$repository) {
         return new Aphront400Response();
     }
     $query_path = $request->getStr('q');
     $query_path = ltrim($query_path, '/');
     if (preg_match('@/$@', $query_path)) {
         $query_dir = $query_path;
     } else {
         $query_dir = dirname($query_path);
         if ($query_dir == '.') {
             $query_dir = '';
         }
     }
     $drequest = DiffusionRequest::newFromAphrontRequestDictionary(array('callsign' => $repository->getCallsign(), 'path' => ':/' . $query_dir));
     $browse_query = DiffusionBrowseQuery::newFromDiffusionRequest($drequest);
     $paths = $browse_query->loadPaths();
     $output = array();
     foreach ($paths as $path) {
         $full_path = $query_dir . $path->getPath();
         if ($path->getFileType() == DifferentialChangeType::FILE_DIRECTORY) {
             $full_path .= '/';
         }
         $output[] = array('/' . $full_path, null, substr(md5($full_path), 0, 7));
     }
     return id(new AphrontAjaxResponse())->setContent($output);
 }
开发者ID:nguyennamtien,项目名称:phabricator,代码行数:31,代码来源:DiffusionPathCompleteController.php

示例3: willProcessRequest

 public function willProcessRequest(array $data)
 {
     $request = $this->getRequest();
     if ($request->getStr('ref')) {
         $parts = explode(';', $request->getStr('ref'));
         $data['path'] = idx($parts, 0);
         $data['commit'] = idx($parts, 1);
     }
     $this->diffusionRequest = DiffusionRequest::newFromAphrontRequestDictionary($data);
 }
开发者ID:nguyennamtien,项目名称:phabricator,代码行数:10,代码来源:DiffusionDiffController.php

示例4: getURI

 public function getURI()
 {
     $repo = $this->getRepository();
     $file = $this->getPath();
     $line = $this->getLineNumber();
     $drequest = DiffusionRequest::newFromAphrontRequestDictionary(array('callsign' => $repo->getCallsign()));
     $branch = $drequest->getBranchURIComponent($drequest->getBranch());
     $file = $branch . ltrim($file, '/');
     return '/diffusion/' . $repo->getCallsign() . '/browse/' . $file . '$' . $line;
 }
开发者ID:netcomtec,项目名称:phabricator,代码行数:10,代码来源:PhabricatorRepositorySymbol.php

示例5: execute

 protected function execute(ConduitAPIRequest $request)
 {
     $results = array();
     $history = DiffusionHistoryQuery::newFromDiffusionRequest(DiffusionRequest::newFromAphrontRequestDictionary($request->getAllParameters()))->setLimit(self::RESULT_LIMIT)->needDirectChanges(true)->needChildChanges(true)->loadHistory();
     $raw_commit_identifiers = mpull($history, 'getCommitIdentifier');
     $result = array();
     foreach ($raw_commit_identifiers as $id) {
         $result[] = 'r' . $request->getValue('callsign') . $id;
     }
     return $result;
 }
开发者ID:nguyennamtien,项目名称:phabricator,代码行数:11,代码来源:ConduitAPI_diffusion_getrecentcommitsbypath_Method.php

示例6: handleRequest

 public final function handleRequest(AphrontRequest $request)
 {
     if ($request->getURIData('callsign') && $this->shouldLoadDiffusionRequest()) {
         try {
             $drequest = DiffusionRequest::newFromAphrontRequestDictionary($request->getURIMap(), $request);
         } catch (Exception $ex) {
             return id(new Aphront404Response())->setRequest($request);
         }
         $this->setDiffusionRequest($drequest);
     }
     return $this->processDiffusionRequest($request);
 }
开发者ID:patelhardik,项目名称:phabricator,代码行数:12,代码来源:DiffusionController.php

示例7: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $repository_phid = $request->getStr('repositoryPHID');
     $repository = id(new PhabricatorRepository())->loadOneWhere('phid = %s', $repository_phid);
     if (!$repository) {
         return new Aphront400Response();
     }
     $path = $request->getStr('path');
     $path = ltrim($path, '/');
     $drequest = DiffusionRequest::newFromAphrontRequestDictionary(array('callsign' => $repository->getCallsign(), 'path' => ':/' . $path));
     $browse_query = DiffusionBrowseQuery::newFromDiffusionRequest($drequest);
     $browse_query->needValidityOnly(true);
     $valid = $browse_query->loadPaths();
     if (!$valid) {
         switch ($browse_query->getReasonForEmptyResultSet()) {
             case DiffusionBrowseQuery::REASON_IS_FILE:
                 $valid = true;
                 break;
             case DiffusionBrowseQuery::REASON_IS_EMPTY:
                 $valid = true;
                 break;
         }
     }
     $output = array('valid' => (bool) $valid);
     if (!$valid) {
         $branch = $drequest->getBranch();
         if ($branch) {
             $message = 'Not found in ' . $branch;
         } else {
             $message = 'Not found at HEAD';
         }
     } else {
         $message = 'OK';
     }
     $output['message'] = $message;
     return id(new AphrontAjaxResponse())->setContent($output);
 }
开发者ID:nguyennamtien,项目名称:phabricator,代码行数:38,代码来源:DiffusionPathValidateController.php

示例8: willProcessRequest

 public function willProcessRequest(array $data)
 {
     $data = $data + array('dblob' => $this->getRequest()->getStr('ref'));
     $drequest = DiffusionRequest::newFromAphrontRequestDictionary($data);
     $this->diffusionRequest = $drequest;
 }
开发者ID:ramons03,项目名称:phabricator,代码行数:6,代码来源:DiffusionDiffController.php

示例9: willProcessRequest

 public function willProcessRequest(array $data)
 {
     $this->diffusionRequest = DiffusionRequest::newFromAphrontRequestDictionary($data);
 }
开发者ID:netcomtec,项目名称:phabricator,代码行数:4,代码来源:DiffusionController.php

示例10: buildDiffusionRequest

 private static function buildDiffusionRequest(PhabricatorRepository $repository, PhabricatorRepositoryCommit $commit)
 {
     return DiffusionRequest::newFromAphrontRequestDictionary(array('callsign' => $repository->getCallsign(), 'commit' => $commit->getCommitIdentifier()));
 }
开发者ID:netcomtec,项目名称:phabricator,代码行数:4,代码来源:PhabricatorOwnerPathQuery.php

示例11: save

 public function save()
 {
     // TODO: Transactions!
     $ret = parent::save();
     if ($this->unsavedOwners) {
         $new_owners = array_fill_keys($this->unsavedOwners, true);
         $cur_owners = array();
         foreach ($this->loadOwners() as $owner) {
             if (empty($new_owners[$owner->getUserPHID()])) {
                 $owner->delete();
                 continue;
             }
             $cur_owners[$owner->getUserPHID()] = true;
         }
         $add_owners = array_diff_key($new_owners, $cur_owners);
         foreach ($add_owners as $phid => $ignored) {
             $owner = new PhabricatorOwnersOwner();
             $owner->setPackageID($this->getID());
             $owner->setUserPHID($phid);
             $owner->save();
         }
         unset($this->unsavedOwners);
     }
     if ($this->unsavedPaths) {
         $new_paths = igroup($this->unsavedPaths, 'repositoryPHID', 'path');
         $cur_paths = $this->loadPaths();
         foreach ($cur_paths as $key => $path) {
             if (empty($new_paths[$path->getRepositoryPHID()][$path->getPath()])) {
                 $path->delete();
                 unset($cur_paths[$key]);
             }
         }
         $cur_paths = mgroup($cur_paths, 'getRepositoryPHID', 'getPath');
         foreach ($new_paths as $repository_phid => $paths) {
             // get repository object for path validation
             $repository = id(new PhabricatorRepository())->loadOneWhere('phid = %s', $repository_phid);
             if (!$repository) {
                 continue;
             }
             foreach ($paths as $path => $ignored) {
                 $path = ltrim($path, '/');
                 // build query to validate path
                 $drequest = DiffusionRequest::newFromAphrontRequestDictionary(array('callsign' => $repository->getCallsign(), 'path' => ':/' . $path));
                 $query = DiffusionBrowseQuery::newFromDiffusionRequest($drequest);
                 $query->needValidityOnly(true);
                 $valid = $query->loadPaths();
                 $is_directory = true;
                 if (!$valid) {
                     switch ($query->getReasonForEmptyResultSet()) {
                         case DiffusionBrowseQuery::REASON_IS_FILE:
                             $valid = true;
                             $is_directory = false;
                             break;
                         case DiffusionBrowseQuery::REASON_IS_EMPTY:
                             $valid = true;
                             break;
                     }
                 }
                 if ($is_directory && substr($path, -1) != '/') {
                     $path .= '/';
                 }
                 if (substr($path, 0, 1) != '/') {
                     $path = '/' . $path;
                 }
                 if (empty($cur_paths[$repository_phid][$path]) && $valid) {
                     $obj = new PhabricatorOwnersPath();
                     $obj->setPackageID($this->getID());
                     $obj->setRepositoryPHID($repository_phid);
                     $obj->setPath($path);
                     $obj->save();
                 }
             }
         }
         unset($this->unsavedPaths);
     }
     return $ret;
 }
开发者ID:netcomtec,项目名称:phabricator,代码行数:77,代码来源:PhabricatorOwnersPackage.php

示例12: processDiffusionRequest

 protected function processDiffusionRequest(AphrontRequest $request)
 {
     $data = $request->getURIMap();
     $data = $data + array('dblob' => $this->getRequest()->getStr('ref'));
     try {
         $drequest = DiffusionRequest::newFromAphrontRequestDictionary($data, $request);
     } catch (Exception $ex) {
         return id(new Aphront404Response())->setRequest($request);
     }
     $this->setDiffusionRequest($drequest);
     $drequest = $this->getDiffusionRequest();
     $viewer = $this->getViewer();
     if (!$request->isAjax()) {
         // This request came out of the dropdown menu, either "View Standalone"
         // or "View Raw File".
         $view = $request->getStr('view');
         if ($view == 'r') {
             $uri = $drequest->generateURI(array('action' => 'browse', 'params' => array('view' => 'raw')));
         } else {
             $uri = $drequest->generateURI(array('action' => 'change'));
         }
         return id(new AphrontRedirectResponse())->setURI($uri);
     }
     $data = $this->callConduitWithDiffusionRequest('diffusion.diffquery', array('commit' => $drequest->getCommit(), 'path' => $drequest->getPath()));
     $drequest->updateSymbolicCommit($data['effectiveCommit']);
     $raw_changes = ArcanistDiffChange::newFromConduit($data['changes']);
     $diff = DifferentialDiff::newEphemeralFromRawChanges($raw_changes);
     $changesets = $diff->getChangesets();
     $changeset = reset($changesets);
     if (!$changeset) {
         return new Aphront404Response();
     }
     $parser = new DifferentialChangesetParser();
     $parser->setUser($viewer);
     $parser->setChangeset($changeset);
     $parser->setRenderingReference($drequest->generateURI(array('action' => 'rendering-ref')));
     $parser->readParametersFromRequest($request);
     $coverage = $drequest->loadCoverage();
     if ($coverage) {
         $parser->setCoverage($coverage);
     }
     $commit = $drequest->loadCommit();
     $pquery = new DiffusionPathIDQuery(array($changeset->getFilename()));
     $ids = $pquery->loadPathIDs();
     $path_id = $ids[$changeset->getFilename()];
     $parser->setLeftSideCommentMapping($path_id, false);
     $parser->setRightSideCommentMapping($path_id, true);
     $parser->setCanMarkDone($commit->getAuthorPHID() && $viewer->getPHID() == $commit->getAuthorPHID());
     $parser->setObjectOwnerPHID($commit->getAuthorPHID());
     $parser->setWhitespaceMode(DifferentialChangesetParser::WHITESPACE_SHOW_ALL);
     $inlines = PhabricatorAuditInlineComment::loadDraftAndPublishedComments($viewer, $commit->getPHID(), $path_id);
     if ($inlines) {
         foreach ($inlines as $inline) {
             $parser->parseInlineComment($inline);
         }
         $phids = mpull($inlines, 'getAuthorPHID');
         $handles = $this->loadViewerHandles($phids);
         $parser->setHandles($handles);
     }
     $engine = new PhabricatorMarkupEngine();
     $engine->setViewer($viewer);
     foreach ($inlines as $inline) {
         $engine->addObject($inline, PhabricatorInlineCommentInterface::MARKUP_FIELD_BODY);
     }
     $engine->process();
     $parser->setMarkupEngine($engine);
     $spec = $request->getStr('range');
     list($range_s, $range_e, $mask) = DifferentialChangesetParser::parseRangeSpecification($spec);
     $parser->setRange($range_s, $range_e);
     $parser->setMask($mask);
     return id(new PhabricatorChangesetResponse())->setRenderedChangeset($parser->renderChangeset())->setUndoTemplates($parser->getRenderer()->renderUndoTemplates());
 }
开发者ID:patelhardik,项目名称:phabricator,代码行数:72,代码来源:DiffusionDiffController.php

示例13: buildDiffusionRequest

 private function buildDiffusionRequest()
 {
     return DiffusionRequest::newFromAphrontRequestDictionary(array('callsign' => $this->repository->getCallsign(), 'commit' => $this->commit->getCommitIdentifier()));
 }
开发者ID:nguyennamtien,项目名称:phabricator,代码行数:4,代码来源:HeraldCommitAdapter.php


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