You are here

function node_revision_delete_confirm_submit in Drupal 5

Same name and namespace in other branches
  1. 4 modules/node.module \node_revision_delete_confirm_submit()
  2. 6 modules/node/node.pages.inc \node_revision_delete_confirm_submit()
  3. 7 modules/node/node.pages.inc \node_revision_delete_confirm_submit()

File

modules/node/node.module, line 1845
The core that allows content to be submitted to the site. Modules and scripts may programmatically submit nodes using the usual form API pattern.

Code

function node_revision_delete_confirm_submit($form_id, $form_values) {
  $node = $form_values['node'];
  db_query("DELETE FROM {node_revisions} WHERE nid = %d AND vid = %d", $node->nid, $node->vid);
  node_invoke_nodeapi($node, 'delete revision');
  drupal_set_message(t('Deleted %title revision %revision.', array(
    '%title' => $node->title,
    '%revision' => $node->vid,
  )));
  watchdog('content', t('@type: deleted %title revision %revision.', array(
    '@type' => t($node->type),
    '%title' => $node->title,
    '%revision' => $node->vid,
  )));
  if (db_result(db_query('SELECT COUNT(vid) FROM {node_revisions} WHERE nid = %d', $node->nid)) > 1) {
    return 'node/' . $node->nid . '/revisions';
  }
  else {
    return 'node/' . $node->nid;
  }
}