You are here

function apachesolr_attachments_delete_file_usage in Apache Solr Attachments 7

Same name and namespace in other branches
  1. 6.3 apachesolr_attachments.index.inc \apachesolr_attachments_delete_file_usage()

Removes a record to indicate that an entity is no longer using a file.

Parameters

$file: A file object.

$parent_entity_type: (optional) The type of the object that contains the referenced file. May be omitted if all module references to a file are being deleted.

$parent_entity_id: (optional) The unique, numeric ID of the object containing the referenced file. May be omitted if all module references to a file are being deleted.

File

./apachesolr_attachments.index.inc, line 247
Indexing-related functions.

Code

function apachesolr_attachments_delete_file_usage(stdClass $file, $parent_entity_type = NULL, $parent_entity_id = NULL) {
  $indexer_table = apachesolr_get_indexer_table('file');
  $query = db_delete($indexer_table)
    ->condition('entity_type', 'file')
    ->condition('entity_id', $file->fid)
    ->condition('parent_entity_type', $parent_entity_type)
    ->condition('parent_entity_id', $parent_entity_id);
}