本文整理汇总了PHP中GitRepository::getNamespace方法的典型用法代码示例。如果您正苦于以下问题:PHP GitRepository::getNamespace方法的具体用法?PHP GitRepository::getNamespace怎么用?PHP GitRepository::getNamespace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GitRepository
的用法示例。
在下文中一共展示了GitRepository::getNamespace方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: forkOnFilesystem
public function forkOnFilesystem(GitRepository $old, GitRepository $new)
{
$name = $old->getName();
//TODO use $old->getRootPath() (good luck for Unit Tests!)
$old_namespace = $old->getProject()->getUnixName() . '/' . $old->getNamespace();
$new_namespace = $new->getProject()->getUnixName() . '/' . $new->getNamespace();
$forkSucceeded = $this->getDriver()->fork($name, $old_namespace, $new_namespace);
if ($forkSucceeded) {
$this->updateRepoConf($new);
}
}
示例2: save
public function save(GitRepository $repository)
{
$id = (int) $repository->getId();
$name = $repository->getName();
$mailPrefix = $repository->getMailPrefix();
$parentId = 0;
$scope = $repository->getScope();
$namespace = $repository->getNamespace();
try {
$parent = $repository->getParent();
if (!empty($parent)) {
$parentId = $parent->getId();
}
} catch (GitDaoException $e) {
}
$projectId = $repository->getProjectId();
$description = $repository->getDescription();
$path = $repository->getPath();
$isInitialized = $repository->getIsInitialized();
$creationUserId = $repository->getCreatorId();
$access = $repository->getAccess();
//protect parameters
$id = $this->da->escapeInt($id);
$name = $this->da->quoteSmart($name);
$description = $this->da->quoteSmart($description);
$path = $this->da->quoteSmart($path);
$projectId = $this->da->escapeInt($projectId);
$isInitialized = $this->da->escapeInt($isInitialized);
$creationUserId = $this->da->escapeInt($creationUserId);
$access = $this->da->quoteSmart($access);
$mailPrefix = $this->da->quoteSmart($mailPrefix);
$scope = $this->da->quoteSmart($scope);
$namespace = $this->da->quoteSmart($namespace);
$backup_path = $this->da->quoteSmart($repository->getBackupPath());
$insert = false;
if ($this->exists($id)) {
$query = 'UPDATE ' . $this->getTable() . ' SET ' . self::REPOSITORY_DESCRIPTION . '=' . $description . ',' . self::REPOSITORY_IS_INITIALIZED . '=' . $isInitialized . ',' . self::REPOSITORY_ACCESS . '=' . $access . ',' . self::REPOSITORY_MAIL_PREFIX . '=' . $mailPrefix . ',' . self::REPOSITORY_BACKUP_PATH . '=' . $backup_path . 'WHERE ' . self::REPOSITORY_ID . '=' . $id;
} else {
if ($repository->getBackend() instanceof Git_Backend_Gitolite) {
$backendType = self::BACKEND_GITOLITE;
} else {
$backendType = self::BACKEND_GITSHELL;
}
$insert = true;
$creationDate = date('Y-m-d H:i:s');
$query = 'INSERT INTO ' . $this->getTable() . '(' . self::REPOSITORY_NAME . ',' . self::REPOSITORY_PATH . ',' . self::REPOSITORY_PARENT . ',' . self::REPOSITORY_DESCRIPTION . ',' . self::FK_PROJECT_ID . ',' . self::REPOSITORY_CREATION_DATE . ',' . self::REPOSITORY_CREATION_USER_ID . ',' . self::REPOSITORY_IS_INITIALIZED . ',' . self::REPOSITORY_ACCESS . ',' . self::REPOSITORY_BACKEND_TYPE . ',' . self::REPOSITORY_SCOPE . ',' . self::REPOSITORY_NAMESPACE . ') values (' . "" . $name . "," . "" . $path . "," . "" . $parentId . "," . "" . $description . "," . $projectId . "," . "'" . $creationDate . "'," . $creationUserId . "," . $isInitialized . ',' . $access . ',' . $this->da->quoteSmart($backendType) . ',' . $scope . ',' . $namespace . ')';
}
if ($this->update($query) === false) {
throw new GitDaoException($GLOBALS['Language']->getText('plugin_git', 'dao_update_error') . ' : ' . $this->da->isError());
}
if ($insert) {
return $this->da->lastInsertId();
}
return true;
}
示例3: fork
/**
* @throws GitRepositoryAlreadyExistsException
*/
public function fork(GitRepository $old, GitRepository $new)
{
$name = $old->getName();
//TODO use $old->getRootPath() (good luck for Unit Tests!)
$old_namespace = $old->getProject()->getUnixName() . '/' . $old->getNamespace();
$new_namespace = $new->getProject()->getUnixName() . '/' . $new->getNamespace();
$new_project = $new->getProject();
if ($this->getDao()->isRepositoryExisting($new_project->getId(), $new->getPath())) {
throw new GitRepositoryAlreadyExistsException('Respository already exists');
} else {
$forkSucceeded = $this->getDriver()->fork($name, $old_namespace, $new_namespace);
if ($forkSucceeded) {
$id = $this->getDao()->save($new);
$new->setId($id);
$this->clonePermissions($old, $new);
$this->updateRepoConf($new);
}
}
}