Пример #1
0
 public function populateView()
 {
     $projects = new GD_Model_ProjectsMapper();
     $project_slug = $this->_getParam("project");
     if ($project_slug != "") {
         $project = $projects->getProjectBySlug($project_slug);
     }
     $deployments_map = new GD_Model_DeploymentsMapper();
     $this->view->deployments = $deployments_map->getDeploymentsByProject($project->getId());
     $this->view->project = $project;
 }
Пример #2
0
 public function deleteAction()
 {
     $projects = new GD_Model_ProjectsMapper();
     $project_slug = $this->_getParam("project");
     $project = $projects->getProjectBySlug($project_slug);
     // Initialise the mapper objects we'll need
     $deploymentsMapper = new GD_Model_DeploymentsMapper();
     $deploymentFilesMapper = new GD_Model_DeploymentFilesMapper();
     $serversMapper = new GD_Model_ServersMapper();
     // Delete the deployments associated with the project.
     $deployments = $deploymentsMapper->getDeploymentsByProject($project->getId());
     foreach ($deployments as $deployment) {
         // Delete the files associated with the project.
         $deploymentFiles = $deploymentFilesMapper->getDeploymentFilesByDeployment($deployment->getId());
         foreach ($deploymentFiles as $deploymentFile) {
             $deploymentFilesMapper->delete($deploymentFile);
         }
         // Delete deployment.
         $deploymentsMapper->delete($deployment);
     }
     // Delete the servers associated with the project.
     $servers = $serversMapper->getServersByProject($project->getId());
     foreach ($servers as $server) {
         $serversMapper->delete($server);
     }
     // Delete the project's git repo.
     $git = new GD_Git($project);
     $git->deleteRepository();
     // Delete the project
     $projects->delete($project);
     $this->_redirect($this->getFrontController()->getBaseUrl() . "/home");
 }