public static function project_new()
 {
     $GLOBALS['smarty']->assign('project_availableConnectors', ScmConnector::getAvailableConnectors());
 }
Exemple #2
0
 public function delete()
 {
     if (!Database::beginTransaction()) {
         SystemEvent::raise(SystemEvent::ERROR, "Couldn't delete project. [ID={$this->getId()}]", __METHOD__);
         return false;
     }
     if (!ScmConnector::delete($this->getScmLocalWorkingCopy())) {
         SystemEvent::raise(SystemEvent::ERROR, "Couldn't delete project sources. [ID={$this->getId()}] [DIR={$this->getScmLocalWorkingCopy()}]", __METHOD__);
     }
     if (!Project_Build::uninstall($this)) {
         Database::rollbackTransaction();
         SystemEvent::raise(SystemEvent::ERROR, "Couldn't delete project build table. [ID={$this->getId()}]", __METHOD__);
         return false;
     }
     if (!Project_Log::uninstall($this)) {
         Database::rollbackTransaction();
         SystemEvent::raise(SystemEvent::ERROR, "Couldn't delete project log table. [ID={$this->getId()}]", __METHOD__);
         return false;
     }
     if (!$this->deleteUsers()) {
         Database::rollbackTransaction();
         SystemEvent::raise(SystemEvent::ERROR, "Couldn't delete project user records. [ID={$this->getId()}]", __METHOD__);
         return false;
     }
     $sql = "DELETE FROM project WHERE id=?";
     if (!Database::execute($sql, array($this->getId()))) {
         Database::rollbackTransaction();
         SystemEvent::raise(SystemEvent::ERROR, "Couldn't delete project. [ID={$this->getId()}]", __METHOD__);
         return false;
     }
     if (!Database::endTransaction()) {
         SystemEvent::raise(SystemEvent::ERROR, "Something occurred while finishing transaction. The project might not have been deleted. [ID={$this->getId()}]", __METHOD__);
         return false;
     }
     SystemEvent::raise(SystemEvent::DEBUG, "Project deleted. [ID={$this->getId()}]");
     $this->setId(null);
     $this->resetSignature();
     // No more saves for this project
     return true;
 }