Example #1
0
 /**
  * Delete all project repositories (on project deletion).
  *
  * @param Project $project
  */
 public function deleteProjectRepositories(Project $project)
 {
     $repositories = $this->repository_factory->getAllRepositories($project);
     foreach ($repositories as $repository) {
         $repository->forceMarkAsDeleted();
         $this->system_event_manager->createEvent('GIT_REPO_DELETE', $project->getID() . SystemEvent::PARAMETER_SEPARATOR . $repository->getId(), SystemEvent::PRIORITY_MEDIUM);
     }
 }
 /**
  * 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;
         }
     }
 }