You are here

function apachesolr_attachments_nodeapi in Apache Solr Attachments 6

Same name and namespace in other branches
  1. 5 apachesolr_attachments.module \apachesolr_attachments_nodeapi()
  2. 6.2 apachesolr_attachments.module \apachesolr_attachments_nodeapi()

Implementation of hook_nodeapi().

For a delete: mark all associated attachments as removed.

File

./apachesolr_attachments.module, line 132
Provides a file attachment search implementation for use with the Apache Solr module

Code

function apachesolr_attachments_nodeapi($node, $op) {
  if ($op == 'delete' || $op == 'update' && !$node->status) {
    apachesolr_attachments_remove_attachments_from_index($node->nid);

    // Mark attachments for later re-deletion in case the query fails.
    db_query("UPDATE {apachesolr_attachments_files} SET removed = 1 WHERE nid = %d", $node->nid);
  }
}