當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。