本文整理汇总了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);
}
}
}
示例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!"}';
}