public function process() { $parameters = $this->getParametersAsArray(); //print_r($parameters); $project = null; if (!empty($parameters[0])) { $project = $this->getProject($parameters[0]); } else { $this->error('Missing argument project id'); return false; } $repositoryName = ''; if (!empty($parameters[1])) { $repositoryName = $parameters[1]; } else { $this->error('Missing argument repository name'); return false; } $parentId = ''; if (!empty($parameters[2])) { $parentId = $parameters[2]; } else { $this->error('Missing argument parent id'); return false; } $userId = 0; if (!empty($parameters[3])) { $userId = $parameters[3]; } else { $this->error('Missing argument user id'); return false; } try { $repository = new GitRepository(); $repository->setProject($project); $repository->setId($parentId); //load before setting creator $repository->load(); $user = null; if (!empty($userId)) { $user = UserManager::instance()->getUserById($userId); } if (!empty($user)) { $repository->setCreator($user); } $repository->forkShell($repositoryName); $this->done(); } catch (GitDaoException $e1) { $this->error($e1->getMessage()); return false; } catch (GitDriverException $e2) { $this->error($e2->getMessage()); return false; } catch (GitBackendException $e3) { $this->error($e3->getMessage()); return false; } catch (Exception $e4) { $this->error($e4->getMessage()); return false; } }