You are here

function _download_count_get_file_by_upload in Download Count 6.2

Same name and namespace in other branches
  1. 7.2 download_count.module \_download_count_get_file_by_upload()

internal functions

2 calls to _download_count_get_file_by_upload()
download_count_file_download in ./download_count.module
Implementation of hook_file_download().
_download_count_is_accessible_by_upload in ./download_count.module

File

./download_count.module, line 301
Tracks file downloads for files stored in the drupal files table using the private files setting or custom private filefield.

Code

function _download_count_get_file_by_upload($filepath) {

  // check if Upload is enabled
  if (!function_exists('upload_perm')) {
    return NULL;
  }

  // upload not enabled
  $result = db_query("SELECT u.nid, u.vid, f.filepath, f.fid FROM {upload} u JOIN {files} f ON f.fid = u.fid WHERE f.filepath = '%s'", $filepath);
  return db_fetch_object($result);
}