示例#1
0
 function remove_process($p_id)
 {
     $this->deactivate_process($p_id);
     $name = $this->_get_normalized_name($p_id);
     // Remove process activities
     $aM = new ActivityManager();
     $query = "select `activity_id` from `" . GALAXIA_TABLE_PREFIX . "activities` where `p_id`=?";
     $result = $this->mDb->query($query, array($p_id));
     while ($res = $result->fetchRow()) {
         $aM->remove_activity($p_id, $res['activity_id']);
     }
     // Remove process roles
     $rM = new RoleManager();
     $query = "select `role_id` from `" . GALAXIA_TABLE_PREFIX . "roles` where `p_id`=?";
     $result = $this->mDb->query($query, array($p_id));
     while ($res = $result->fetchRow()) {
         $rM->remove_role($p_id, $res['role_id']);
     }
     $query = "delete from `" . GALAXIA_TABLE_PREFIX . "instances` where `p_id`=?";
     $this->mDb->query($query, array($p_id));
     // Remove the directory structure
     if (!empty($name) && is_dir(GALAXIA_PROCESSES . "/{$name}")) {
         $this->_remove_directory(GALAXIA_PROCESSES . "/{$name}", true);
     }
     if (GALAXIA_TEMPLATES && !empty($name) && is_dir(GALAXIA_TEMPLATES . "/{$name}")) {
         $this->_remove_directory(GALAXIA_TEMPLATES . "/{$name}", true);
     }
     // And finally remove the proc
     $query = "delete from `" . GALAXIA_TABLE_PREFIX . "processes` where `p_id`={$p_id}";
     $this->mDb->query($query);
     $msg = sprintf(tra('Process %s removed'), $name);
     $this->notify_all(5, $msg);
     return true;
 }