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


PHP GitRepository::setBackend方法代码示例

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


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

示例1: process

 public function process()
 {
     global $sys_allow_restricted_users;
     $parameters = $this->getParametersAsArray();
     $project = null;
     if (!empty($parameters[0])) {
         $project = $this->getProject($parameters[0]);
     } else {
         $this->error('Missing argument project id');
         return false;
     }
     $repositoryName = '';
     if (!empty($parameters[1])) {
         $repositoryName = $parameters[1];
     } else {
         $this->error('Missing argument repository name');
         return false;
     }
     $userId = 0;
     if (!empty($parameters[2])) {
         $userId = $parameters[2];
     } else {
         $this->error('Missing argument user id');
         return false;
     }
     try {
         $repository = new GitRepository();
         $repository->setBackend(Backend::instance('Git', 'GitBackend'));
         $repository->setDescription('-- Default description --');
         //default access is private when restricted users are allowed
         if ($sys_allow_restricted_users == 1) {
             $repository->setAccess(GitRepository::PRIVATE_ACCESS);
         } else {
             $repository->setAccess(GitRepository::PUBLIC_ACCESS);
         }
         $user = null;
         if (!empty($userId)) {
             $user = UserManager::instance()->getUserById($userId);
         }
         if (!empty($user)) {
             $repository->setCreator($user);
         }
         $repository->setProject($project);
         $repository->setName($repositoryName);
         $repository->create();
         $this->done();
     } catch (GitDaoException $e) {
         $this->error($e->getMessage());
         return false;
     } catch (GitDriverException $e) {
         $this->error($e->getMessage());
         return false;
     } catch (GitBackendException $e) {
         $this->error($e->getMessage());
         return false;
     } catch (Exception $e) {
         $this->error($e->getMessage());
         return false;
     }
 }
开发者ID:nterray,项目名称:tuleap,代码行数:60,代码来源:SystemEvent_GIT_REPO_CREATE.class.php

示例2: generateGitRepository

 public function generateGitRepository()
 {
     echo "Create Git repo\n";
     $repository_factory = new GitRepositoryFactory(new GitDao(), $this->project_manager);
     $git_system_event_manager = new Git_SystemEventManager($this->system_event_manager, $repository_factory);
     $manager = $this->getGitRepositoryManager($repository_factory, $git_system_event_manager);
     $backend = $this->getGitBackendGitolite($git_system_event_manager);
     $repository = new GitRepository();
     $repository->setBackend($backend);
     $repository->setDescription("Git repository");
     $repository->setCreator($this->user_manager->getUserByUserName(self::TEST_USER_1_NAME));
     $repository->setProject($this->project_manager->getProjectByUnixName(self::PROJECT_TEST_GIT_SHORTNAME));
     $repository->setName('repo01');
     $manager->create($repository, $backend, array());
     return $this;
 }
开发者ID:blestab,项目名称:tuleap,代码行数:16,代码来源:GitDataBuilder.php

示例3: createReference

 public function createReference($projectId, $repositoryName)
 {
     $controller = $this->getController();
     $projectId = intval($projectId);
     try {
         $creator = UserManager::instance()->getCurrentUser();
         $repository = new GitRepository();
         $repository->setBackend($this->backend_gitolite);
         $repository->setDescription(GitRepository::DEFAULT_DESCRIPTION);
         $repository->setCreator($creator);
         $repository->setProject(ProjectManager::instance()->getProject($projectId));
         $repository->setName($repositoryName);
         $this->manager->create($repository, $this->backend_gitolite);
         $this->history_dao->groupAddHistory("git_repo_create", $repositoryName, $projectId);
         $this->redirectToRepo($repository);
     } catch (Exception $exception) {
         $controller->addError($exception->getMessage());
     }
     $controller->redirect('/plugins/git/?action=index&group_id=' . $projectId);
     return;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:21,代码来源:GitActions.class.php

示例4: createReference

 public function createReference($projectId, $repositoryName)
 {
     // Uncomment the following line only for debug prupose if you ever need to
     // create a gitshell repo (good luck, luke, may the force be with you).
     //$this->createGitshellReference($projectId, $repositoryName);
     $c = $this->getController();
     $projectId = intval($projectId);
     try {
         $repository = new GitRepository();
         $repository->setBackend(new Git_Backend_Gitolite(new Git_GitoliteDriver()));
         $repository->setDescription('-- Default description --');
         $repository->setCreator(UserManager::instance()->getCurrentUser());
         $repository->setProject(ProjectManager::instance()->getProject($projectId));
         $repository->setName($repositoryName);
         $this->manager->create($repository);
     } catch (Exception $exception) {
         $c->addError($exception->getMessage());
     }
     $c->redirect('/plugins/git/?action=index&group_id=' . $projectId);
     return;
 }
开发者ID:nickl-,项目名称:tuleap,代码行数:21,代码来源:GitActions.class.php

示例5: buildRepository

 /**
  * Returns a default-value-filled repository
  * @return GitRepository
  */
 public function buildRepository(Project $project, $repository_name, PFUser $creator, Git_Backend_Interface $backend, $description = GitRepository::DEFAULT_DESCRIPTION)
 {
     $repository = new GitRepository();
     $repository->setBackend($backend);
     $repository->setDescription($description);
     $repository->setCreator($creator);
     $repository->setProject($project);
     $repository->setName($repository_name);
     return $repository;
 }
开发者ID:superlinger,项目名称:tuleap,代码行数:14,代码来源:GitRepositoryFactory.class.php

示例6: setUp

 public function setUp()
 {
     parent::setUp();
     $this->backend = mock('GitBackend');
     $this->repository = new GitRepository();
     $this->repository->setBackend($this->backend);
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:7,代码来源:GitRepositoryTest.php

示例7: _aGitRepoWith

 private function _aGitRepoWith($user, $repo, $namespace, $backend, $scope)
 {
     $clone = new GitRepository();
     $clone->setCreator($user);
     $clone->setNamespace($namespace);
     $clone->setBackend($backend);
     $clone->setParent($repo);
     $clone->setScope($scope);
     $clone->setName($repo->getName());
     return $clone;
 }
开发者ID:nterray,项目名称:tuleap,代码行数:11,代码来源:GitRepositoryTest.php


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