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


PHP Git::cloneRepo方法代码示例

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


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

示例1: joinProject

 /**
  * Associate user with the project. Owner is automatically assigned by newProject calling this method.
  * This method also creates the git repository and assigns basic configuration
  */
 public function joinProject($pid)
 {
     if ($this->_uid == false) {
         throw new Exception(NO_USER);
     }
     $data = array('pid' => $pid, 'uid' => $this->_uid);
     $result = $this->_db->insert('user_project', $data);
     //returns the number of rows inserted
     if ($result == 1) {
         //select the project as the active project once the required db entry exists
         $this->selectProject($pid);
         $git = new Git();
         if ($this->active->owner == $this->_uid) {
             if (file_exists($this->getPath() . $this->_userPath)) {
                 throw new Exception('User directory in project folder already exists');
             }
             if (!mkdir($this->getPath() . $this->_userPath)) {
                 throw new Exception('Unable to create a user directory in the project folder');
             }
             //===== GIT INIT =====
             $git->initRepo($this->_userName, $this->_userEmail);
         } else {
             //clone should crete the user directory as it is required to clone to new dir
             //===== GIT CLONE =====
             $git->cloneRepo($this->_userName, $this->_userEmail, $this->active->owner, $this->_uid);
         }
     }
 }
开发者ID:reveil,项目名称:CodeTornado,代码行数:32,代码来源:Project.php

示例2:

     }
     break;
 case 'init':
     if (isset($_GET['path'])) {
         if ($git->init(getWorkspacePath($_GET['path']))) {
             echo '{"status":"success","message":"Initialized empty Git repository!"}';
         } else {
             echo '{"status":"error","message":"' . $git->result . '!"}';
         }
     } else {
         echo '{"status":"error","message":"Missing parameter!"}';
     }
     break;
 case 'clone':
     if (isset($_GET['path']) && isset($_GET['repo'])) {
         echo $git->cloneRepo(getWorkspacePath($_GET['path']), $_GET['repo']);
     } else {
         echo '{"status":"error","message":"Missing parameter!"}';
     }
     break;
 case 'status':
     if (isset($_GET['path'])) {
         $result = $git->status(getWorkspacePath($_GET['path']));
         if ($result === false) {
             echo '{"status":"error","message":"Failed to get status!"}';
         } else {
             echo '{"status":"success","data":' . json_encode($result) . '}';
         }
     } else {
         echo '{"status":"error","message":"Missing parameter!"}';
     }
开发者ID:practico,项目名称:Codiad-CodeGit,代码行数:31,代码来源:controller.php


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