コード例 #1
0
 public function deleteAction()
 {
     $project_slug = $this->_getParam("project");
     $servers = new GD_Model_ServersMapper();
     $server = new GD_Model_Server();
     $server_id = $this->_request->getParam('id', 0);
     if ($server_id > 0) {
         $servers->find($server_id, $server);
         $servers->delete($server);
         $this->_redirect($this->getFrontController()->getBaseUrl() . "/project/" . $project_slug . "/settings");
     } else {
         throw new Zend_Exception("Server id was not specified");
     }
 }
コード例 #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");
 }