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


PHP PhabricatorRepository::isHosted方法代码示例

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


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

示例1: handleHosting

 public function handleHosting(PhabricatorRepository $repository)
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     $v_hosting = $repository->isHosted();
     $edit_uri = $this->getRepositoryControllerURI($repository, 'edit/');
     $next_uri = $this->getRepositoryControllerURI($repository, 'edit/serve/');
     if ($request->isFormPost()) {
         $v_hosting = $request->getBool('hosting');
         $xactions = array();
         $template = id(new PhabricatorRepositoryTransaction());
         $type_hosting = PhabricatorRepositoryTransaction::TYPE_HOSTING;
         $xactions[] = id(clone $template)->setTransactionType($type_hosting)->setNewValue($v_hosting);
         id(new PhabricatorRepositoryEditor())->setContinueOnNoEffect(true)->setContentSourceFromRequest($request)->setActor($user)->applyTransactions($repository, $xactions);
         return id(new AphrontRedirectResponse())->setURI($next_uri);
     }
     $crumbs = $this->buildApplicationCrumbs();
     $crumbs->addTextCrumb(pht('Edit Hosting'));
     $title = pht('Edit Hosting (%s)', $repository->getName());
     $hosted_control = id(new AphrontFormRadioButtonControl())->setName('hosting')->setLabel(pht('Hosting'))->addButton(true, pht('Host Repository on Phabricator'), pht('Phabricator will host this repository. Users will be able to ' . 'push commits to Phabricator. Phabricator will not pull ' . 'changes from elsewhere.'))->addButton(false, pht('Host Repository Elsewhere'), pht('Phabricator will pull updates to this repository from a master ' . 'repository elsewhere (for example, on GitHub or Bitbucket). ' . 'Users will not be able to push commits to this repository.'))->setValue($v_hosting);
     $doc_href = PhabricatorEnv::getDoclink('Diffusion User Guide: Repository Hosting');
     $form = id(new AphrontFormView())->setUser($user)->appendRemarkupInstructions(pht('Phabricator can host repositories, or it can track repositories ' . 'hosted elsewhere (like on GitHub or Bitbucket). For information ' . 'on configuring hosting, see [[ %s | Diffusion User Guide: ' . 'Repository Hosting]]', $doc_href))->appendChild($hosted_control)->appendChild(id(new AphrontFormSubmitControl())->setValue(pht('Save and Continue'))->addCancelButton($edit_uri));
     $object_box = id(new PHUIObjectBoxView())->setHeaderText($title)->setForm($form);
     return $this->buildApplicationPage(array($crumbs, $object_box), array('title' => $title));
 }
开发者ID:denghp,项目名称:phabricator,代码行数:25,代码来源:DiffusionRepositoryEditHostingController.php

示例2: createMenuItem

 public function createMenuItem(PhabricatorUser $viewer, DifferentialRevision $revision, PhabricatorRepository $repository)
 {
     $vcs = $repository->getVersionControlSystem();
     if ($vcs !== PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL) {
         return;
     }
     if (!$repository->isHosted()) {
         return;
     }
     return $this->createActionView($revision, pht('Land to Hosted Repository'));
 }
开发者ID:denghp,项目名称:phabricator,代码行数:11,代码来源:DifferentialLandingToHostedMercurial.php

示例3: createMenuItem

 public function createMenuItem(PhabricatorUser $viewer, DifferentialRevision $revision, PhabricatorRepository $repository)
 {
     $vcs = $repository->getVersionControlSystem();
     if ($vcs !== PhabricatorRepositoryType::REPOSITORY_TYPE_GIT) {
         return;
     }
     if (!$repository->isHosted()) {
         return;
     }
     if (!$repository->isWorkingCopyBare()) {
         return;
     }
     // TODO: This temporarily disables this action, because it doesn't work
     // and is confusing to users. If you want to use it, comment out this line
     // for now and we'll provide real support eventually.
     return;
     return $this->createActionView($revision, pht('Land to Hosted Repository'));
 }
开发者ID:pugong,项目名称:phabricator,代码行数:18,代码来源:DifferentialHostedGitLandingStrategy.php

示例4: createMenuItem

 /**
  * returns PhabricatorActionView or an array of PhabricatorActionView or null.
  */
 public function createMenuItem(PhabricatorUser $viewer, DifferentialRevision $revision, PhabricatorRepository $repository)
 {
     $vcs = $repository->getVersionControlSystem();
     if ($vcs !== PhabricatorRepositoryType::REPOSITORY_TYPE_GIT) {
         return;
     }
     if ($repository->isHosted()) {
         return;
     }
     try {
         // These throw when failing.
         $this->init($viewer, $repository);
         $this->findGitHubRepo($repository);
     } catch (Exception $e) {
         return;
     }
     return $this->createActionView($revision, pht('Land to GitHub'))->setIcon('fa-cloud-upload');
 }
开发者ID:denghp,项目名称:phabricator,代码行数:21,代码来源:DifferentialLandingToGitHub.php

示例5: getCleanGitWorkspace

 /**
  * Creates and/or cleans a workspace for the requested repo.
  *
  * return ArcanistGitAPI
  */
 public static function getCleanGitWorkspace(PhabricatorRepository $repo)
 {
     $origin_path = $repo->getLocalPath();
     $path = rtrim($origin_path, '/');
     $path = $path . '__workspace';
     if (!Filesystem::pathExists($path)) {
         $repo->execxLocalCommand('clone -- file://%s %s', $origin_path, $path);
         if (!$repo->isHosted()) {
             id(new ArcanistGitAPI($path))->execxLocal('remote set-url origin %s', $repo->getRemoteURI());
         }
     }
     $workspace = new ArcanistGitAPI($path);
     $workspace->execxLocal('clean -f -d');
     $workspace->execxLocal('checkout master');
     $workspace->execxLocal('fetch');
     $workspace->execxLocal('reset --hard origin/master');
     $workspace->reloadWorkingCopy();
     return $workspace;
 }
开发者ID:denghp,项目名称:phabricator,代码行数:24,代码来源:DifferentialGetWorkingCopy.php

示例6: createMenuItem

 /**
  * Returns PhabricatorActionView or an array of PhabricatorActionView or null.
  */
 public function createMenuItem(PhabricatorUser $viewer, DifferentialRevision $revision, PhabricatorRepository $repository)
 {
     // TODO: This temporarily disables this action, because it doesn't work
     // and is confusing to users. If you want to use it, comment out this line
     // for now and we'll provide real support eventually.
     return;
     $vcs = $repository->getVersionControlSystem();
     if ($vcs !== PhabricatorRepositoryType::REPOSITORY_TYPE_GIT) {
         return;
     }
     if ($repository->isHosted()) {
         return;
     }
     try {
         // These throw when failing.
         $this->init($viewer, $repository);
         $this->findGitHubRepo($repository);
     } catch (Exception $e) {
         return;
     }
     return $this->createActionView($revision, pht('Land to GitHub'))->setIcon('fa-cloud-upload');
 }
开发者ID:pugong,项目名称:phabricator,代码行数:25,代码来源:DifferentialGitHubLandingStrategy.php

示例7: renderCloneCommand

 private function renderCloneCommand(PhabricatorRepository $repository, $uri, $serve_mode = null, $manage_uri = null)
 {
     require_celerity_resource('diffusion-icons-css');
     Javelin::initBehavior('select-on-click');
     switch ($repository->getVersionControlSystem()) {
         case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
             $command = csprintf('git clone %R', $uri);
             break;
         case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL:
             $command = csprintf('hg clone %R', $uri);
             break;
         case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
             if ($repository->isHosted()) {
                 $command = csprintf('svn checkout %R %R', $uri, $repository->getCloneName());
             } else {
                 $command = csprintf('svn checkout %R', $uri);
             }
             break;
     }
     $input = javelin_tag('input', array('type' => 'text', 'value' => (string) $command, 'class' => 'diffusion-clone-uri', 'sigil' => 'select-on-click', 'readonly' => 'true'));
     $extras = array();
     if ($serve_mode) {
         if ($serve_mode === PhabricatorRepository::SERVE_READONLY) {
             $extras[] = pht('(Read Only)');
         }
     }
     if ($manage_uri) {
         if ($this->getRequest()->getUser()->isLoggedIn()) {
             $extras[] = phutil_tag('a', array('href' => $manage_uri), pht('Manage Credentials'));
         }
     }
     if ($extras) {
         $extras = phutil_implode_html(' ', $extras);
         $extras = phutil_tag('div', array('class' => 'diffusion-clone-extras'), $extras);
     }
     return array($input, $extras);
 }
开发者ID:patelhardik,项目名称:phabricator,代码行数:37,代码来源:DiffusionRepositoryController.php

示例8: buildRepositoryStatus

 private function buildRepositoryStatus(PhabricatorRepository $repository)
 {
     $viewer = $this->getRequest()->getUser();
     $is_cluster = $repository->getAlmanacServicePHID();
     $view = new PHUIStatusListView();
     $messages = id(new PhabricatorRepositoryStatusMessage())->loadAllWhere('repositoryID = %d', $repository->getID());
     $messages = mpull($messages, null, 'getStatusType');
     if ($repository->isTracked()) {
         $view->addItem(id(new PHUIStatusItemView())->setIcon(PHUIStatusItemView::ICON_ACCEPT, 'green')->setTarget(pht('Repository Active')));
     } else {
         $view->addItem(id(new PHUIStatusItemView())->setIcon(PHUIStatusItemView::ICON_WARNING, 'bluegrey')->setTarget(pht('Repository Inactive'))->setNote(pht('Activate this repository to begin or resume import.')));
         return $view;
     }
     $binaries = array();
     $svnlook_check = false;
     switch ($repository->getVersionControlSystem()) {
         case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
             $binaries[] = 'git';
             break;
         case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
             $binaries[] = 'svn';
             break;
         case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL:
             $binaries[] = 'hg';
             break;
     }
     if ($repository->isHosted()) {
         if ($repository->getServeOverHTTP() != PhabricatorRepository::SERVE_OFF) {
             switch ($repository->getVersionControlSystem()) {
                 case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
                     $binaries[] = 'git-http-backend';
                     break;
                 case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
                     $binaries[] = 'svnserve';
                     $binaries[] = 'svnadmin';
                     $binaries[] = 'svnlook';
                     $svnlook_check = true;
                     break;
                 case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL:
                     $binaries[] = 'hg';
                     break;
             }
         }
         if ($repository->getServeOverSSH() != PhabricatorRepository::SERVE_OFF) {
             switch ($repository->getVersionControlSystem()) {
                 case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
                     $binaries[] = 'git-receive-pack';
                     $binaries[] = 'git-upload-pack';
                     break;
                 case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
                     $binaries[] = 'svnserve';
                     $binaries[] = 'svnadmin';
                     $binaries[] = 'svnlook';
                     $svnlook_check = true;
                     break;
                 case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL:
                     $binaries[] = 'hg';
                     break;
             }
         }
     }
     $binaries = array_unique($binaries);
     if (!$is_cluster) {
         // We're only checking for binaries if we aren't running with a cluster
         // configuration. In theory, we could check for binaries on the
         // repository host machine, but we'd need to make this more complicated
         // to do that.
         foreach ($binaries as $binary) {
             $where = Filesystem::resolveBinary($binary);
             if (!$where) {
                 $view->addItem(id(new PHUIStatusItemView())->setIcon(PHUIStatusItemView::ICON_WARNING, 'red')->setTarget(pht('Missing Binary %s', phutil_tag('tt', array(), $binary)))->setNote(pht("Unable to find this binary in the webserver's PATH. You may " . "need to configure %s.", $this->getEnvConfigLink())));
             } else {
                 $view->addItem(id(new PHUIStatusItemView())->setIcon(PHUIStatusItemView::ICON_ACCEPT, 'green')->setTarget(pht('Found Binary %s', phutil_tag('tt', array(), $binary)))->setNote(phutil_tag('tt', array(), $where)));
             }
         }
         // This gets checked generically above. However, for svn commit hooks, we
         // need this to be in environment.append-paths because subversion strips
         // PATH.
         if ($svnlook_check) {
             $where = Filesystem::resolveBinary('svnlook');
             if ($where) {
                 $path = substr($where, 0, strlen($where) - strlen('svnlook'));
                 $dirs = PhabricatorEnv::getEnvConfig('environment.append-paths');
                 $in_path = false;
                 foreach ($dirs as $dir) {
                     if (Filesystem::isDescendant($path, $dir)) {
                         $in_path = true;
                         break;
                     }
                 }
                 if (!$in_path) {
                     $view->addItem(id(new PHUIStatusItemView())->setIcon(PHUIStatusItemView::ICON_WARNING, 'red')->setTarget(pht('Missing Binary %s', phutil_tag('tt', array(), $binary)))->setNote(pht('Unable to find this binary in `%s`. ' . 'You need to configure %s and include %s.', 'environment.append-paths', $this->getEnvConfigLink(), $path)));
                 }
             }
         }
     }
     $doc_href = PhabricatorEnv::getDocLink('Managing Daemons with phd');
     $daemon_instructions = pht('Use %s to start daemons. See %s.', phutil_tag('tt', array(), 'bin/phd start'), phutil_tag('a', array('href' => $doc_href), pht('Managing Daemons with phd')));
     $pull_daemon = id(new PhabricatorDaemonLogQuery())->setViewer(PhabricatorUser::getOmnipotentUser())->withStatus(PhabricatorDaemonLogQuery::STATUS_ALIVE)->withDaemonClasses(array('PhabricatorRepositoryPullLocalDaemon'))->setLimit(1)->execute();
     if ($pull_daemon) {
//.........这里部分代码省略.........
开发者ID:patelhardik,项目名称:phabricator,代码行数:101,代码来源:DiffusionRepositoryEditMainController.php

示例9: getObservedVersion

 private function getObservedVersion(PhabricatorRepository $repository)
 {
     if ($repository->isHosted()) {
         return null;
     }
     if ($repository->isGit()) {
         return $this->getGitObservedVersion($repository);
     }
     return null;
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:10,代码来源:PhabricatorRepositoryDiscoveryEngine.php


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