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


PHP PhabricatorRepository::parseRepositoryServicePath方法代码示例

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


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

示例1: loadRepositoryWithPath

 protected function loadRepositoryWithPath($path)
 {
     $viewer = $this->getUser();
     $info = PhabricatorRepository::parseRepositoryServicePath($path);
     if ($info === null) {
         throw new Exception(pht('Unrecognized repository path "%s". Expected a path like "%s" ' . 'or "%s".', $path, '/diffusion/X/', '/diffusion/123/'));
     }
     $identifier = $info['identifier'];
     $base = $info['base'];
     $this->baseRequestPath = $base;
     $repository = id(new PhabricatorRepositoryQuery())->setViewer($viewer)->withIdentifiers(array($identifier))->needURIs(true)->executeOne();
     if (!$repository) {
         throw new Exception(pht('No repository "%s" exists!', $identifier));
     }
     $protocol = PhabricatorRepositoryURI::BUILTIN_PROTOCOL_SSH;
     if (!$repository->canServeProtocol($protocol, false)) {
         throw new Exception(pht('This repository ("%s") is not available over SSH.', $repository->getDisplayName()));
     }
     return $repository;
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:20,代码来源:DiffusionSSHWorkflow.php

示例2: getRequestDirectoryPath

 private function getRequestDirectoryPath(PhabricatorRepository $repository)
 {
     $request = $this->getRequest();
     $request_path = $request->getRequestURI()->getPath();
     $info = PhabricatorRepository::parseRepositoryServicePath($request_path, $repository->getVersionControlSystem());
     $base_path = $info['path'];
     // For Git repositories, strip an optional directory component if it
     // isn't the name of a known Git resource. This allows users to clone
     // repositories as "/diffusion/X/anything.git", for example.
     if ($repository->isGit()) {
         $known = array('info', 'git-upload-pack', 'git-receive-pack');
         foreach ($known as $key => $path) {
             $known[$key] = preg_quote($path, '@');
         }
         $known = implode('|', $known);
         if (preg_match('@^/([^/]+)/(' . $known . ')(/|$)@', $base_path)) {
             $base_path = preg_replace('@^/([^/]+)@', '', $base_path);
         }
     }
     return $base_path;
 }
开发者ID:NeoArmageddon,项目名称:phabricator,代码行数:21,代码来源:DiffusionServeController.php

示例3: loadRepositoryWithPath

 protected function loadRepositoryWithPath($path)
 {
     $viewer = $this->getUser();
     $info = PhabricatorRepository::parseRepositoryServicePath($path);
     if ($info === null) {
         throw new Exception(pht('Unrecognized repository path "%s". Expected a path like "%s" ' . 'or "%s".', $path, '/diffusion/X/', '/diffusion/123/'));
     }
     $identifier = $info['identifier'];
     $base = $info['base'];
     $this->baseRequestPath = $base;
     $repository = id(new PhabricatorRepositoryQuery())->setViewer($viewer)->withIdentifiers(array($identifier))->executeOne();
     if (!$repository) {
         throw new Exception(pht('No repository "%s" exists!', $identifier));
     }
     switch ($repository->getServeOverSSH()) {
         case PhabricatorRepository::SERVE_READONLY:
         case PhabricatorRepository::SERVE_READWRITE:
             // If we have read or read/write access, proceed for now. We will
             // check write access when the user actually issues a write command.
             break;
         case PhabricatorRepository::SERVE_OFF:
         default:
             throw new Exception(pht('This repository ("%s") is not available over SSH.', $repository->getDisplayName()));
     }
     return $repository;
 }
开发者ID:Houzz,项目名称:phabricator,代码行数:26,代码来源:DiffusionSSHWorkflow.php


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