本文整理汇总了PHP中GitRepository::getProject方法的典型用法代码示例。如果您正苦于以下问题:PHP GitRepository::getProject方法的具体用法?PHP GitRepository::getProject怎么用?PHP GitRepository::getProject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GitRepository
的用法示例。
在下文中一共展示了GitRepository::getProject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getView
private function getView()
{
if (empty($_REQUEST['a'])) {
$_REQUEST['a'] = 'summary';
} else {
if ($_REQUEST['a'] === 'blobdiff' && isset($_REQUEST['jenkins']) && $_REQUEST['jenkins'] === 'true') {
$this->inverseURLArgumentsForGitPhpDiff();
}
}
set_time_limit(300);
$_GET['a'] = $_REQUEST['a'];
$_REQUEST['group_id'] = $this->repository->getProjectId();
$_REQUEST['repo_id'] = $this->repository->getId();
$_REQUEST['repo_name'] = $this->repository->getFullName();
$_GET['p'] = $_REQUEST['repo_name'] . '.git';
$_REQUEST['repo_path'] = $this->repository->getPath();
$_REQUEST['project_dir'] = $this->repository->getProject()->getUnixName();
$_REQUEST['git_root_path'] = $this->repository->getGitRootPath();
$_REQUEST['action'] = 'view';
$this->preSanitizeRequestForGitphp();
if (empty($_REQUEST['noheader'])) {
echo '<div id="gitphp" class="plugin_git_gitphp">';
}
include $this->getGitPhpIndexPath();
if (empty($_REQUEST['noheader'])) {
echo '</div>';
}
}
示例2: displayAccessControl
/**
* Display access control management for gitolite backend
*
* @param Integer $project_id Project Id, to manage permissions when performing a cross project fork
*
* @return String
*/
public function displayAccessControl($project_id = null)
{
$project = $project_id ? ProjectManager::instance()->getProject($project_id) : $this->repository->getProject();
$renderer = TemplateRendererFactory::build()->getRenderer(dirname(GIT_BASE_DIR) . '/templates');
$presenter = new GitPresenters_AccessControlPresenter($this->repository->isMigratedToGerrit() ? true : false, 'repo_access[' . Git::PERM_READ . ']', 'repo_access[' . Git::PERM_WRITE . ']', 'repo_access[' . Git::PERM_WPLUS . ']', $this->getOptions($project, Git::PERM_READ), $this->getOptions($project, Git::PERM_WRITE), $this->getOptions($project, Git::PERM_WPLUS));
return $renderer->renderToString('access-control', $presenter);
}
示例3: getRepositoryBaseUrl
/**
* @param GitRepository $repository
* @return string the base url to access the git repository regarding plugin configuration
*/
public function getRepositoryBaseUrl(GitRepository $repository)
{
if ($this->git_plugin->areFriendlyUrlsActivated()) {
return GIT_BASE_URL . '/' . $repository->getProject()->getUnixName() . '/' . $repository->getFullName();
} else {
return GIT_BASE_URL . '/index.php/' . $repository->getProjectId() . '/view/' . $repository->getId() . '/';
}
}
示例4: getProject
/**
* @return Project|null
*/
public function getProject()
{
if (!$this->repository) {
if (!preg_match($this->standard_index_pattern, $this->uri, $matches)) {
return null;
}
return $this->project_manager->getProject($matches['project_id']);
}
return $this->repository->getProject();
}
示例5: getForRepository
public function getForRepository(GitRepository $repository)
{
$project = $repository->getProject();
$repo_config = '';
$repo_config .= $this->fetchConfigPermissions($project, $repository, Git::PERM_READ);
$repo_config .= $this->formatPermission(Git::PERM_READ, $this->getMirrorUserNames($repository));
if ($repository->isMigratedToGerrit()) {
$key = new Git_RemoteServer_Gerrit_ReplicationSSHKey();
$key->setGerritHostId($repository->getRemoteServerId());
$repo_config .= $this->formatPermission(Git::PERM_WPLUS, array($key->getUserName()));
} else {
$repo_config .= $this->fetchConfigPermissions($project, $repository, Git::PERM_WRITE);
$repo_config .= $this->fetchConfigPermissions($project, $repository, Git::PERM_WPLUS);
}
return $repo_config;
}
示例6: buildPanes
/**
* @return array
*/
private function buildPanes(GitRepository $repository)
{
$panes = array(new GitViews_RepoManagement_Pane_GeneralSettings($repository, $this->request));
if ($repository->getBackendType() == GitDao::BACKEND_GITOLITE) {
$panes[] = new GitViews_RepoManagement_Pane_Gerrit($repository, $this->request, $this->driver_factory, $this->gerrit_servers, $this->gerrit_config_templates);
}
$panes[] = new GitViews_RepoManagement_Pane_AccessControl($repository, $this->request);
$mirrors = $this->mirror_data_mapper->fetchAllForProject($repository->getProject());
if (count($mirrors) > 0) {
$repository_mirrors = $this->mirror_data_mapper->fetchAllRepositoryMirrors($repository);
$panes[] = new GitViews_RepoManagement_Pane_Mirroring($repository, $this->request, $mirrors, $repository_mirrors);
}
$panes[] = new GitViews_RepoManagement_Pane_Notification($repository, $this->request);
$panes[] = new GitViews_RepoManagement_Pane_Delete($repository, $this->request);
$indexed_panes = array();
foreach ($panes as $pane) {
if ($pane->canBeDisplayed()) {
$indexed_panes[$pane->getIdentifier()] = $pane;
}
}
return $indexed_panes;
}
示例7: shouldAddRegisteredUsersToGroup
private function shouldAddRegisteredUsersToGroup(GitRepository $repository, $permission, $group)
{
return array_intersect(array(ProjectUGroup::ANONYMOUS, ProjectUGroup::REGISTERED, ProjectUGroup::AUTHENTICATED), $group) && $repository->getProject()->isPublic() && $this->user_finder->areRegisteredUsersAllowedTo($permission, $repository);
}
示例8: inSameProject
private function inSameProject(GitRepository $repository1, GitRepository $repository2)
{
return $repository1->getProject()->getId() == $repository2->getProject()->getId();
}
示例9: isInPrivateProject
private function isInPrivateProject(GitRepository $repository)
{
return $repository->getProject()->isPublic() == false;
}
示例10: getAccessURL
/**
* Return URL to access the respository for remote git commands
*
* @param GitRepository $repository
* @return String
*/
public function getAccessURL(GitRepository $repository)
{
$serverName = $_SERVER['SERVER_NAME'];
$user = UserManager::instance()->getCurrentUser();
return array('ssh' => $user->getUserName() . '@' . $serverName . ':/gitroot/' . $repository->getProject()->getUnixName() . '/' . $repository->getName() . '.git');
}
示例11: delete
public function delete(GitRepository $repository)
{
$id = $repository->getId();
$projectId = $repository->getProjectId();
$id = $this->da->escapeInt($id);
$projectId = $this->da->escapeInt($projectId);
if (empty($id) || empty($projectId)) {
throw new GitDaoException($GLOBALS['Language']->getText('plugin_git', 'dao_delete_params'));
}
$deletionDate = $repository->getDeletionDate();
$projectName = $repository->getProject()->getUnixName();
$backup_path = str_replace('/', '_', $repository->getFullName());
$backup_path .= '_' . strtotime($deletionDate);
$backup_path = $projectName . '_' . $backup_path;
$backup_path = $this->da->quoteSmart($backup_path);
$deletionDate = $this->da->quoteSmart($deletionDate);
$query = ' UPDATE ' . $this->getTable() . ' SET ' . self::REPOSITORY_DELETION_DATE . '=' . $deletionDate . ', ' . self::REPOSITORY_BACKUP_PATH . '=' . $backup_path . ' WHERE ' . self::REPOSITORY_ID . '=' . $id . ' AND ' . self::FK_PROJECT_ID . '=' . $projectId;
$r = $this->update($query);
$ar = $this->da->affectedRows();
if ($r === false || $ar == 0) {
throw new GitDaoException($GLOBALS['Language']->getText('plugin_git', 'dao_delete_error') . ' ' . $this->da->isError());
}
if ($ar == 1) {
return true;
}
return false;
}
示例12: getView
/**
* Configure gitphp output
*
* @param GitRepository $repository
*/
public function getView($repository)
{
include_once 'common/include/Codendi_HTMLPurifier.class.php';
if (empty($_REQUEST['a'])) {
$_REQUEST['a'] = 'summary';
}
set_time_limit(300);
$_GET['a'] = $_REQUEST['a'];
$_REQUEST['group_id'] = $this->groupId;
$_REQUEST['repo_id'] = $repository->getId();
$_REQUEST['repo_name'] = $repository->getFullName();
$_GET['p'] = $_REQUEST['repo_name'] . '.git';
$_REQUEST['repo_path'] = $repository->getPath();
$_REQUEST['project_dir'] = $repository->getProject()->getUnixName();
$_REQUEST['git_root_path'] = $repository->getGitRootPath();
$_REQUEST['action'] = 'view';
if (empty($_REQUEST['noheader'])) {
//echo '<hr>';
echo '<div id="gitphp">';
}
include $this->getGitPhpIndexPath();
if (empty($_REQUEST['noheader'])) {
echo '</div>';
}
}
示例13: executeForRepository
/**
* Trigger jobs corresponding to the Git repository
*
* @param GitRepository $repository_location Name of the git repository
*/
public function executeForRepository(GitRepository $repository)
{
if ($repository->getProject()->usesService('hudson')) {
$this->launchForRepository($repository);
}
}
示例14: getGerritProjectName
public function getGerritProjectName(GitRepository $repository)
{
$project = $repository->getProject()->getUnixName();
$repo = $repository->getFullName();
return "{$project}/{$repo}";
}
示例15: isRepositoryNameAlreadyUsed
/**
* Return true if proposed name already exists as a repository path
*
* @param Project $project
* @param String $name
*
* @return Boolean
*/
public function isRepositoryNameAlreadyUsed(GitRepository $new_repository)
{
$repositories = $this->repository_factory->getAllRepositories($new_repository->getProject());
foreach ($repositories as $existing_repo) {
$new_repo_path = $new_repository->getPathWithoutLazyLoading();
$existing_repo_path = $existing_repo->getPathWithoutLazyLoading();
if ($new_repo_path == $existing_repo_path) {
return true;
}
if ($this->nameIsSubPathOfExistingRepository($existing_repo_path, $new_repo_path)) {
return true;
}
if ($this->nameAlreadyExistsAsPath($existing_repo_path, $new_repo_path)) {
return true;
}
}
}