Exemple #1
0
 public static function deleteProject($project_name)
 {
     $table = new USVN_Db_Table_Projects();
     $project = $table->fetchRow(array('projects_name = ?' => $project_name));
     if ($project === null) {
         throw new USVN_Exception(T_("Project %s doesn't exist."), $project_name);
     }
     $project->delete();
     $groups = new USVN_Db_Table_Groups();
     $where = $groups->getAdapter()->quoteInto("groups_name = ?", $project_name);
     $group = $groups->fetchRow($where);
     if ($group !== null) {
         $group->delete();
     }
     USVN_DirectoryUtils::removeDirectory(Zend_Registry::get('config')->subversion->path . DIRECTORY_SEPARATOR . 'svn' . DIRECTORY_SEPARATOR . $project_name);
 }
Exemple #2
0
 /**
  * Save all information
  *
  */
 public function save()
 {
     $this->user->save();
     if ($this->createGroup) {
         $table = new USVN_Db_Table_Groups();
         $group = $table->createRow(array("groups_name" => $this->user->login));
         try {
             $group->save();
             $this->groups[] = $group->id;
         } catch (Exception $e) {
             $table = new USVN_Db_Table_Groups();
             $where = $table->getAdapter()->quoteInto('groups_name = ?', $this->user->login);
             $row = $table->fetchRow($where);
             if ($row != null) {
                 $this->user->delete();
                 throw new USVN_Exception(T_("This user can't be created. A group has the same name."));
             } else {
                 throw $e;
             }
         }
     }
     if ($this->groups !== null) {
         $this->user->deleteAllGroups();
         foreach ($this->groups as $group) {
             $this->user->addGroup($group);
         }
     }
 }