Example #1
0
 /**
  * Fork a bunch of repositories in a project for a given user
  * 
  * @param int    $groupId   The project id
  * @param array  $repos_ids The array of id of repositories to fork
  * @param string $namespace The namespace where the new repositories will live
  * @param User   $user      The owner of those new repositories
  * @param Layout $response  The response object
  */
 public function fork(array $repos, Project $to_project, $namespace, $scope, User $user, Layout $response, $redirect_url)
 {
     try {
         if ($this->manager->forkRepositories($repos, $to_project, $user, $namespace, $scope)) {
             $GLOBALS['Response']->addFeedback('info', $this->getText('successfully_forked'));
             $response->redirect($redirect_url);
         }
     } catch (Exception $e) {
         $GLOBALS['Response']->addFeedback('error', $e->getMessage());
     }
 }
Example #2
0
 /**
  * Fork a bunch of repositories in a project for a given user
  *
  * @param int    $groupId         The project id
  * @param array  $repos_ids       The array of id of repositories to fork
  * @param string $namespace       The namespace where the new repositories will live
  * @param PFUser   $user            The owner of those new repositories
  * @param Layout $response        The response object
  * @param array  $forkPermissions Permissions to be applied for the new repository
  */
 public function fork(array $repos, Project $to_project, $namespace, $scope, PFUser $user, Layout $response, $redirect_url, array $forkPermissions)
 {
     try {
         if ($this->manager->forkRepositories($repos, $to_project, $user, $namespace, $scope, $forkPermissions)) {
             $this->history_dao->groupAddHistory("git_fork_repositories", $to_project->getID(), $to_project->getID());
             $GLOBALS['Response']->addFeedback('info', $this->getText('successfully_forked'));
             $response->redirect($redirect_url);
         }
     } catch (Exception $e) {
         $GLOBALS['Response']->addFeedback('error', $e->getMessage());
     }
 }
 private function importRepository(Project $project, PFUser $creator, SimpleXMLElement $repository_xmlnode, $extraction_path)
 {
     $repository_info = $repository_xmlnode->attributes();
     $this->logger->debug("Importing {$repository_info['name']} using {$repository_info['bundle-path']}");
     $description = isset($repository_info['description']) ? (string) $repository_info['description'] : GitRepository::DEFAULT_DESCRIPTION;
     $repository = $this->repository_factory->buildRepository($project, $repository_info['name'], $creator, $this->gitolite_backend, $description);
     $absolute_bundle_path = $extraction_path . '/' . $repository_info['bundle-path'];
     $extraction_path_arg = escapeshellarg($extraction_path);
     $this->system_command->exec("chmod 755 {$extraction_path_arg}");
     $this->repository_manager->createFromBundle($repository, $this->gitolite_backend, $absolute_bundle_path);
     $this->importPermissions($project, $repository_xmlnode->children(), $repository);
     $this->system_event_manager->queueProjectsConfigurationUpdate(array($project->getGroupId()));
 }