You are here

function workflow_deletewf in Workflow 5

Same name and namespace in other branches
  1. 5.2 workflow.module \workflow_deletewf()
  2. 6.2 workflow.module \workflow_deletewf()
  3. 6 workflow.module \workflow_deletewf()

Delete a workflow from the database. Deletes all states, transitions and node type mappings too. Removes workflow state information from nodes participating in this workflow.

Parameters

$wid: The ID of the workflow.

1 call to workflow_deletewf()
workflow_delete_form_submit in ./workflow.module

File

./workflow.module, line 1533

Code

function workflow_deletewf($wid) {
  $wf = workflow_get_name($wid);
  $result = db_query('SELECT sid FROM {workflow_states} WHERE wid = %d', $wid);
  while ($data = db_fetch_object($result)) {

    // delete the state and any associated transitions and actions
    workflow_state_delete($data->sid);
    db_query('DELETE FROM {workflow_node} WHERE sid = %d', $data->sid);
  }
  workflow_types_delete($wid);
  db_query('DELETE FROM {workflows} WHERE wid = %d', $wid);
}