/** * @Route("/webhook/{name}", requirements={ "name": "[\w-_.]+"}) */ public function triggerAction(Repo $repo) { $repos = $this->getParameter('repos_location'); if (!is_dir($repos)) { dump('lol1'); mkdir($repos); } chdir($repos); exec('git clone ' . $repo->getFromUrl() . ' ' . $repo->getName()); chdir($repos . '/' . $repo->getName()); exec('git fetch && git remote add to ' . escapeshellarg($repo->getToUrl())); exec('git config remote.to.push +refs/remotes/origin/*:refs/heads/*'); exec('git push to'); chdir($repos); $this->deleteDirectory($repos . '/' . $repo->getName()); return new Response($repo->getName()); }
/** * Creates a form to delete a Repo entity. * * @param Repo $repo The Repo entity * * @return \Symfony\Component\Form\Form The form */ private function createDeleteForm(Repo $repo) { return $this->createFormBuilder()->setAction($this->generateUrl('repo_delete', array('id' => $repo->getId())))->setMethod('DELETE')->getForm(); }