You are here

function node_accessibility_delete_node_problems in Node Accessibility 7

Deletes the node report data from the database.

This is primarly used to remove data for a node that no longer has any validation failures.

Parameters

int $nid: The node id of the node associated with the given reports.

int|null $vid: (optional) The node revision id of the node associated with the given reports.

Return value

bool TRUE on success, FALSE otherwise.

7 calls to node_accessibility_delete_node_problems()
node_accessibility_accessibility_tab_page in includes/pages.inc
Provides the accessibility tab page.
node_accessibility_delete_action in ./node_accessibility.module
Delete accessibility validation statistics for a node.
node_accessibility_drush_callback_validate in ./node_accessibility.drush.inc
Drush command callback.
node_accessibility_node_delete in ./node_accessibility.module
Implements hook_node_delete().
node_accessibility_node_revision_delete in ./node_accessibility.module
Implements hook_node_revision_delete().

... See full list

File

./node_accessibility.module, line 701
Module file for the node accessibility project.

Code

function node_accessibility_delete_node_problems($nid, $vid = NULL) {
  if (!is_numeric($nid)) {
    if (class_exists('cf_error')) {
      cf_error::invalid_numeric('nid');
    }
    return FALSE;
  }
  if (!is_null($vid) && !is_numeric($vid)) {
    if (class_exists('cf_error')) {
      cf_error::invalid_numeric('vid');
    }
    return FALSE;
  }

  // @todo when vid support is added, be sure to add a conditional check against vid here
  $query = db_delete('node_accessibility_problems');
  $query
    ->condition('nid', $nid);
  if (!is_null($vid)) {
    $query
      ->condition('vid', $vid);
  }
  try {
    return $query
      ->execute();
  } catch (Exception $e) {
    if (class_exists('cf_error')) {
      cf_error::on_query_execution($e);
    }
  }
  return FALSE;
}