You are here

protected function SearchApiAttachmentsAlterSettings::getRealpath in Search API attachments 7

Helper method to get a file's real path.

Parameters

object $file: The file.

Return value

string The real path.

6 calls to SearchApiAttachmentsAlterSettings::getRealpath()
SearchApiAttachmentsAlterSettings::extractPdftotext in includes/callback_attachments_settings.inc
Extracts pdf file content using pdftotext.
SearchApiAttachmentsAlterSettings::extractPythonPdf2txt in includes/callback_attachments_settings.inc
Extracts pdf file content using python pdf2txt script.
SearchApiAttachmentsAlterSettings::extractSimple in includes/callback_attachments_settings.inc
Extracts file content for text files.
SearchApiAttachmentsAlterSettings::extractSolr in includes/callback_attachments_settings.inc
Extract data using Solr.
SearchApiAttachmentsAlterSettings::extractTika in includes/callback_attachments_settings.inc
Extracts file content using local tika executable.

... See full list

File

includes/callback_attachments_settings.inc, line 653
Search API data alteration callback.

Class

SearchApiAttachmentsAlterSettings
Indexes files content.

Code

protected function getRealpath($file) {
  $wrapper = file_stream_wrapper_get_instance_by_uri($file['uri']);
  $scheme = file_uri_scheme($file['uri']);
  $local_wrappers = file_get_stream_wrappers(STREAM_WRAPPERS_LOCAL);
  if (in_array($scheme, array_keys($local_wrappers))) {
    return $wrapper
      ->realpath();
  }
  elseif (is_object($wrapper)) {
    return $wrapper
      ->getExternalUrl();
  }
}