function apachesolr_attachments_status_callback in Apache Solr Attachments 7
Same name and namespace in other branches
- 6.3 apachesolr_attachments.module \apachesolr_attachments_status_callback()
Status callback for the files. Files should never be removed from the table. See apachesolr_attachments_apachesolr_exclude() for exclusion of items
Parameters
type $entity_id:
type $entity_type:
Return value
type
1 string reference to 'apachesolr_attachments_status_callback'
- apachesolr_attachments_apachesolr_entity_info_alter in ./
apachesolr_attachments.module - @file Indexer for the userhook_apachesolr_entity_info_alter entities for the Apachesolr module.
File
- ./
apachesolr_attachments.module, line 343 - Provides a file attachment search implementation for use with the Apache Solr module
Code
function apachesolr_attachments_status_callback($entity_id, $entity_type) {
module_load_include('inc', 'apachesolr_attachments', 'apachesolr_attachments.index');
// load the entity and reset cache
$entities = entity_load($entity_type, array(
$entity_id,
), NULL, TRUE);
$entity = reset($entities);
// Check if the mimetype is allowed
if (apachesolr_attachments_allowed_mime($entity->filemime) == FALSE) {
// Set status to 0 and remove from the index
return FALSE;
}
// Check if the file is a real file
if (apachesolr_attachments_is_file($entity) == FALSE) {
// Set status to 0 and remove from the index
return FALSE;
}
// Check if the entity status is active
if ($entity->status != 1) {
// Set status to 0 and remove from the index
return FALSE;
}
// Keep status at 1
return TRUE;
}