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


PHP PhabricatorRepository::getProtocolAvailabilityName方法代码示例

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


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

示例1: handleProtocols

 public function handleProtocols(PhabricatorRepository $repository)
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     $type = $repository->getVersionControlSystem();
     $is_svn = $type == PhabricatorRepositoryType::REPOSITORY_TYPE_SVN;
     $v_http_mode = $repository->getDetail('serve-over-http', PhabricatorRepository::SERVE_OFF);
     $v_ssh_mode = $repository->getDetail('serve-over-ssh', PhabricatorRepository::SERVE_OFF);
     $edit_uri = $this->getRepositoryControllerURI($repository, 'edit/');
     $prev_uri = $this->getRepositoryControllerURI($repository, 'edit/hosting/');
     if ($request->isFormPost()) {
         $v_http_mode = $request->getStr('http');
         $v_ssh_mode = $request->getStr('ssh');
         $xactions = array();
         $template = id(new PhabricatorRepositoryTransaction());
         $type_http = PhabricatorRepositoryTransaction::TYPE_PROTOCOL_HTTP;
         $type_ssh = PhabricatorRepositoryTransaction::TYPE_PROTOCOL_SSH;
         if (!$is_svn) {
             $xactions[] = id(clone $template)->setTransactionType($type_http)->setNewValue($v_http_mode);
         }
         $xactions[] = id(clone $template)->setTransactionType($type_ssh)->setNewValue($v_ssh_mode);
         id(new PhabricatorRepositoryEditor())->setContinueOnNoEffect(true)->setContentSourceFromRequest($request)->setActor($user)->applyTransactions($repository, $xactions);
         return id(new AphrontRedirectResponse())->setURI($edit_uri);
     }
     $crumbs = $this->buildApplicationCrumbs();
     $crumbs->addTextCrumb(pht('Edit Protocols'));
     $title = pht('Edit Protocols (%s)', $repository->getName());
     $rw_message = pht('Phabricator will serve a read-write copy of this repository.');
     if (!$repository->isHosted()) {
         $rw_message = array($rw_message, phutil_tag('br'), phutil_tag('br'), pht('%s: This repository is hosted elsewhere, so Phabricator can not ' . 'perform writes. This mode will act like "Read Only" for ' . 'repositories hosted elsewhere.', phutil_tag('strong', array(), 'WARNING')));
     }
     $ssh_control = id(new AphrontFormRadioButtonControl())->setName('ssh')->setLabel(pht('SSH'))->setValue($v_ssh_mode)->addButton(PhabricatorRepository::SERVE_OFF, PhabricatorRepository::getProtocolAvailabilityName(PhabricatorRepository::SERVE_OFF), pht('Phabricator will not serve this repository over SSH.'))->addButton(PhabricatorRepository::SERVE_READONLY, PhabricatorRepository::getProtocolAvailabilityName(PhabricatorRepository::SERVE_READONLY), pht('Phabricator will serve a read-only copy of this repository ' . 'over SSH.'))->addButton(PhabricatorRepository::SERVE_READWRITE, PhabricatorRepository::getProtocolAvailabilityName(PhabricatorRepository::SERVE_READWRITE), $rw_message);
     $http_control = id(new AphrontFormRadioButtonControl())->setName('http')->setLabel(pht('HTTP'))->setValue($v_http_mode)->addButton(PhabricatorRepository::SERVE_OFF, PhabricatorRepository::getProtocolAvailabilityName(PhabricatorRepository::SERVE_OFF), pht('Phabricator will not serve this repository over HTTP.'))->addButton(PhabricatorRepository::SERVE_READONLY, PhabricatorRepository::getProtocolAvailabilityName(PhabricatorRepository::SERVE_READONLY), pht('Phabricator will serve a read-only copy of this repository ' . 'over HTTP.'))->addButton(PhabricatorRepository::SERVE_READWRITE, PhabricatorRepository::getProtocolAvailabilityName(PhabricatorRepository::SERVE_READWRITE), $rw_message);
     if ($is_svn) {
         $http_control = id(new AphrontFormMarkupControl())->setLabel(pht('HTTP'))->setValue(phutil_tag('em', array(), pht('Phabricator does not currently support HTTP access to ' . 'Subversion repositories.')));
     }
     $form = id(new AphrontFormView())->setUser($user)->appendRemarkupInstructions(pht('Phabricator can serve repositories over various protocols. You can ' . 'configure server protocols here.'))->appendChild($ssh_control);
     if (!PhabricatorEnv::getEnvConfig('diffusion.allow-http-auth')) {
         $form->appendRemarkupInstructions(pht('NOTE: The configuration setting [[ %s | %s ]] is currently ' . 'disabled. You must enable it to activate authenticated access ' . 'to repositories over HTTP.', '/config/edit/diffusion.allow-http-auth/', 'diffusion.allow-http-auth'));
     }
     $form->appendChild($http_control)->appendChild(id(new AphrontFormSubmitControl())->setValue(pht('Save Changes'))->addCancelButton($prev_uri, pht('Back')));
     $object_box = id(new PHUIObjectBoxView())->setHeaderText($title)->setForm($form);
     return $this->buildApplicationPage(array($crumbs, $object_box), array('title' => $title));
 }
开发者ID:denghp,项目名称:phabricator,代码行数:44,代码来源:DiffusionRepositoryEditHostingController.php

示例2: buildHostingProperties

 private function buildHostingProperties(PhabricatorRepository $repository, PhabricatorActionListView $actions)
 {
     $user = $this->getRequest()->getUser();
     $view = id(new PHUIPropertyListView())->setUser($user)->setActionList($actions);
     $hosting = $repository->isHosted() ? pht('Hosted on Phabricator') : pht('Hosted Elsewhere');
     $view->addProperty(pht('Hosting'), phutil_tag('em', array(), $hosting));
     $view->addProperty(pht('Serve over HTTP'), phutil_tag('em', array(), PhabricatorRepository::getProtocolAvailabilityName($repository->getServeOverHTTP())));
     $view->addProperty(pht('Serve over SSH'), phutil_tag('em', array(), PhabricatorRepository::getProtocolAvailabilityName($repository->getServeOverSSH())));
     if ($repository->canAllowDangerousChanges()) {
         if ($repository->shouldAllowDangerousChanges()) {
             $description = pht('Allowed');
         } else {
             $description = pht('Not Allowed');
         }
         $view->addProperty(pht('Dangerous Changes'), $description);
     }
     return $view;
 }
开发者ID:patelhardik,项目名称:phabricator,代码行数:18,代码来源:DiffusionRepositoryEditMainController.php

示例3: getTitle


//.........这里部分代码省略.........
             break;
         case self::TYPE_AUTOCLOSE:
             if ($new) {
                 return pht('%s enabled autoclose for this repository.', $this->renderHandleLink($author_phid));
             } else {
                 return pht('%s disabled autoclose for this repository.', $this->renderHandleLink($author_phid));
             }
             break;
         case self::TYPE_REMOTE_URI:
             if (!strlen($old)) {
                 return pht('%s set the remote URI for this repository to "%s".', $this->renderHandleLink($author_phid), $new);
             } else {
                 if (!strlen($new)) {
                     return pht('%s removed the remote URI for this repository.', $this->renderHandleLink($author_phid));
                 } else {
                     return pht('%s changed the remote URI for this repository from "%s" to "%s".', $this->renderHandleLink($author_phid), $old, $new);
                 }
             }
             break;
         case self::TYPE_SSH_LOGIN:
             return pht('%s updated the SSH login for this repository.', $this->renderHandleLink($author_phid));
         case self::TYPE_SSH_KEY:
             return pht('%s updated the SSH key for this repository.', $this->renderHandleLink($author_phid));
         case self::TYPE_SSH_KEYFILE:
             return pht('%s updated the SSH keyfile for this repository.', $this->renderHandleLink($author_phid));
         case self::TYPE_HTTP_LOGIN:
             return pht('%s updated the HTTP login for this repository.', $this->renderHandleLink($author_phid));
         case self::TYPE_HTTP_PASS:
             return pht('%s updated the HTTP password for this repository.', $this->renderHandleLink($author_phid));
         case self::TYPE_LOCAL_PATH:
             return pht('%s changed the local path from "%s" to "%s".', $this->renderHandleLink($author_phid), $old, $new);
         case self::TYPE_HOSTING:
             if ($new) {
                 return pht('%s changed this repository to be hosted on Phabricator.', $this->renderHandleLink($author_phid));
             } else {
                 return pht('%s changed this repository to track a remote elsewhere.', $this->renderHandleLink($author_phid));
             }
         case self::TYPE_PROTOCOL_HTTP:
             return pht('%s changed the availability of this repository over HTTP from ' . '"%s" to "%s".', $this->renderHandleLink($author_phid), PhabricatorRepository::getProtocolAvailabilityName($old), PhabricatorRepository::getProtocolAvailabilityName($new));
         case self::TYPE_PROTOCOL_SSH:
             return pht('%s changed the availability of this repository over SSH from ' . '"%s" to "%s".', $this->renderHandleLink($author_phid), PhabricatorRepository::getProtocolAvailabilityName($old), PhabricatorRepository::getProtocolAvailabilityName($new));
         case self::TYPE_PUSH_POLICY:
             return pht('%s changed the push policy of this repository from "%s" to "%s".', $this->renderHandleLink($author_phid), $this->renderPolicyName($old, 'old'), $this->renderPolicyName($new, 'new'));
         case self::TYPE_DANGEROUS:
             if ($new) {
                 return pht('%s disabled protection against dangerous changes.', $this->renderHandleLink($author_phid));
             } else {
                 return pht('%s enabled protection against dangerous changes.', $this->renderHandleLink($author_phid));
             }
         case self::TYPE_SLUG:
             if (strlen($old) && !strlen($new)) {
                 return pht('%s removed the short name of this repository.', $this->renderHandleLink($author_phid));
             } else {
                 if (strlen($new) && !strlen($old)) {
                     return pht('%s set the short name of this repository to "%s".', $this->renderHandleLink($author_phid), $new);
                 } else {
                     return pht('%s changed the short name of this repository from "%s" to "%s".', $this->renderHandleLink($author_phid), $old, $new);
                 }
             }
         case self::TYPE_SERVICE:
             if (strlen($old) && !strlen($new)) {
                 return pht('%s moved storage for this repository from %s to local.', $this->renderHandleLink($author_phid), $this->renderHandleLink($old));
             } else {
                 if (!strlen($old) && strlen($new)) {
                     // TODO: Possibly, we should distinguish between automatic assignment
                     // on creation vs explicit adjustment.
                     return pht('%s set storage for this repository to %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($new));
                 } else {
                     return pht('%s moved storage for this repository from %s to %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($old), $this->renderHandleLink($new));
                 }
             }
         case self::TYPE_SYMBOLS_SOURCES:
             return pht('%s changed symbol sources from %s to %s.', $this->renderHandleLink($author_phid), empty($old) ? pht('None') : $this->renderHandleList($old), empty($new) ? pht('None') : $this->renderHandleList($new));
         case self::TYPE_SYMBOLS_LANGUAGE:
             return pht('%s changed indexed languages from %s to %s.', $this->renderHandleLink($author_phid), $old ? implode(', ', $old) : pht('Any'), $new ? implode(', ', $new) : pht('Any'));
         case self::TYPE_STAGING_URI:
             if (!$old) {
                 return pht('%s set "%s" as the staging area for this repository.', $this->renderHandleLink($author_phid), $new);
             } else {
                 if (!$new) {
                     return pht('%s removed "%s" as the staging area for this repository.', $this->renderHandleLink($author_phid), $old);
                 } else {
                     return pht('%s changed the staging area for this repository from ' . '"%s" to "%s".', $this->renderHandleLink($author_phid), $old, $new);
                 }
             }
         case self::TYPE_AUTOMATION_BLUEPRINTS:
             $add = array_diff($new, $old);
             $rem = array_diff($old, $new);
             if ($add && $rem) {
                 return pht('%s changed %s automation blueprint(s), ' . 'added %s: %s; removed %s: %s.', $this->renderHandleLink($author_phid), new PhutilNumber(count($add) + count($rem)), new PhutilNumber(count($add)), $this->renderHandleList($add), new PhutilNumber(count($rem)), $this->renderHandleList($rem));
             } else {
                 if ($add) {
                     return pht('%s added %s automation blueprint(s): %s.', $this->renderHandleLink($author_phid), new PhutilNumber(count($add)), $this->renderHandleList($add));
                 } else {
                     return pht('%s removed %s automation blueprint(s): %s.', $this->renderHandleLink($author_phid), new PhutilNumber(count($rem)), $this->renderHandleList($rem));
                 }
             }
     }
     return parent::getTitle();
 }
开发者ID:truSense,项目名称:phabricator,代码行数:101,代码来源:PhabricatorRepositoryTransaction.php

示例4: getTitle


//.........这里部分代码省略.........
             if (!$new) {
                 return pht('%s set this repository to autoclose on all branches.', $this->renderHandleLink($author_phid));
             } else {
                 if (!$old) {
                     return pht('%s set this repository to autoclose on branches: %s.', $this->renderHandleLink($author_phid), implode(', ', $new));
                 } else {
                     return pht('%s changed autoclose branches from "%s" to "%s".', $this->renderHandleLink($author_phid), implode(', ', $old), implode(', ', $new));
                 }
             }
             break;
         case self::TYPE_UUID:
             if (!strlen($new)) {
                 return pht('%s removed "%s" as the repository UUID.', $this->renderHandleLink($author_phid), $old);
             } else {
                 if (!strlen($old)) {
                     return pht('%s set the repository UUID to "%s".', $this->renderHandleLink($author_phid), $new);
                 } else {
                     return pht('%s changed the repository UUID from "%s" to "%s".', $this->renderHandleLink($author_phid), $old, $new);
                 }
             }
             break;
         case self::TYPE_SVN_SUBPATH:
             if (!strlen($new)) {
                 return pht('%s removed "%s" as the Import Only path.', $this->renderHandleLink($author_phid), $old);
             } else {
                 if (!strlen($old)) {
                     return pht('%s set the repository to import only "%s".', $this->renderHandleLink($author_phid), $new);
                 } else {
                     return pht('%s changed the import path from "%s" to "%s".', $this->renderHandleLink($author_phid), $old, $new);
                 }
             }
             break;
         case self::TYPE_NOTIFY:
             if ($new) {
                 return pht('%s enabled notifications and publishing for this repository.', $this->renderHandleLink($author_phid));
             } else {
                 return pht('%s disabled notifications and publishing for this repository.', $this->renderHandleLink($author_phid));
             }
             break;
         case self::TYPE_AUTOCLOSE:
             if ($new) {
                 return pht('%s enabled autoclose for this repository.', $this->renderHandleLink($author_phid));
             } else {
                 return pht('%s disabled autoclose for this repository.', $this->renderHandleLink($author_phid));
             }
             break;
         case self::TYPE_REMOTE_URI:
             if (!strlen($old)) {
                 return pht('%s set the remote URI for this repository to "%s".', $this->renderHandleLink($author_phid), $new);
             } else {
                 if (!strlen($new)) {
                     return pht('%s removed the remote URI for this repository.', $this->renderHandleLink($author_phid));
                 } else {
                     return pht('%s changed the remote URI for this repository from "%s" to "%s".', $this->renderHandleLink($author_phid), $old, $new);
                 }
             }
             break;
         case self::TYPE_SSH_LOGIN:
             return pht('%s updated the SSH login for this repository.', $this->renderHandleLink($author_phid));
         case self::TYPE_SSH_KEY:
             return pht('%s updated the SSH key for this repository.', $this->renderHandleLink($author_phid));
         case self::TYPE_SSH_KEYFILE:
             return pht('%s updated the SSH keyfile for this repository.', $this->renderHandleLink($author_phid));
         case self::TYPE_HTTP_LOGIN:
             return pht('%s updated the HTTP login for this repository.', $this->renderHandleLink($author_phid));
         case self::TYPE_HTTP_PASS:
             return pht('%s updated the HTTP password for this repository.', $this->renderHandleLink($author_phid));
         case self::TYPE_LOCAL_PATH:
             return pht('%s changed the local path from "%s" to "%s".', $this->renderHandleLink($author_phid), $old, $new);
         case self::TYPE_HOSTING:
             if ($new) {
                 return pht('%s changed this repository to be hosted on Phabricator.', $this->renderHandleLink($author_phid));
             } else {
                 return pht('%s changed this repository to track a remote elsewhere.', $this->renderHandleLink($author_phid));
             }
         case self::TYPE_PROTOCOL_HTTP:
             return pht('%s changed the availability of this repository over HTTP from ' . '"%s" to "%s".', $this->renderHandleLink($author_phid), PhabricatorRepository::getProtocolAvailabilityName($old), PhabricatorRepository::getProtocolAvailabilityName($new));
         case self::TYPE_PROTOCOL_SSH:
             return pht('%s changed the availability of this repository over SSH from ' . '"%s" to "%s".', $this->renderHandleLink($author_phid), PhabricatorRepository::getProtocolAvailabilityName($old), PhabricatorRepository::getProtocolAvailabilityName($new));
         case self::TYPE_PUSH_POLICY:
             return pht('%s changed the push policy of this repository from "%s" to "%s".', $this->renderHandleLink($author_phid), $this->renderPolicyName($old, 'old'), $this->renderPolicyName($new, 'new'));
         case self::TYPE_DANGEROUS:
             if ($new) {
                 return pht('%s disabled protection against dangerous changes.', $this->renderHandleLink($author_phid));
             } else {
                 return pht('%s enabled protection against dangerous changes.', $this->renderHandleLink($author_phid));
             }
         case self::TYPE_CLONE_NAME:
             if (strlen($old) && !strlen($new)) {
                 return pht('%s removed the clone name of this repository.', $this->renderHandleLink($author_phid));
             } else {
                 if (strlen($new) && !strlen($old)) {
                     return pht('%s set the clone name of this repository to "%s".', $this->renderHandleLink($author_phid), $new);
                 } else {
                     return pht('%s changed the clone name of this repository from "%s" to "%s".', $this->renderHandleLink($author_phid), $old, $new);
                 }
             }
     }
     return parent::getTitle();
 }
开发者ID:denghp,项目名称:phabricator,代码行数:101,代码来源:PhabricatorRepositoryTransaction.php


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