You are here

function apachesolr_attachments_is_file in Apache Solr Attachments 7

Same name and namespace in other branches
  1. 6.3 apachesolr_attachments.module \apachesolr_attachments_is_file()
3 calls to apachesolr_attachments_is_file()
apachesolr_attachments_get_attachment_text in ./apachesolr_attachments.index.inc
Parse the attachment getting just the raw text.
apachesolr_attachments_node_solr_document in ./apachesolr_attachments.module
Builds the file-specific information for a Solr document.
apachesolr_attachments_status_callback in ./apachesolr_attachments.module
Status callback for the files. Files should never be removed from the table. See apachesolr_attachments_apachesolr_exclude() for exclusion of items

File

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

Code

function apachesolr_attachments_is_file($entity) {
  if (!empty($entity->uri)) {
    $filepath = drupal_realpath($entity->uri);

    // Check that we have a valid filepath.
    if (!$filepath) {
      return FALSE;
    }
    elseif (!is_file($filepath)) {
      watchdog('Apache Solr Attachments', '%filepath is not a valid file path', array(
        '%filepath' => $entity->uri,
      ), WATCHDOG_WARNING);
      return FALSE;
    }
    else {
      return TRUE;
    }
  }
  return FALSE;
}