You are here

function uc_file_get_by_id in Ubercart 7.3

Same name and namespace in other branches
  1. 8.4 uc_file/uc_file.module \uc_file_get_by_id()
  2. 6.2 uc_file/uc_file.module \uc_file_get_by_id()

Retrieves a file by file ID.

Parameters

$fid: A file ID.

Return value

A uc_file object.

9 calls to uc_file_get_by_id()
uc_file_admin_files_form_action in uc_file/uc_file.admin.inc
Performs file action (upload, delete, hooked in actions).
uc_file_remove_user_file_by_id in uc_file/uc_file.module
Removes a user's downloadable file by hash key.
uc_file_user_renew in uc_file/uc_file.module
Adds file(s) to a user's list of downloadable files, accumulating limits.
_uc_file_build_js_file_display in uc_file/uc_file.admin.inc
Shows all possible files in selectable list.
_uc_file_download in uc_file/uc_file.pages.inc
Handles file downloading and error states.

... See full list

File

uc_file/uc_file.module, line 1519
Allows products to be associated with downloadable files.

Code

function &uc_file_get_by_id($fid) {
  $cache = _uc_file_get_cache();
  if (!isset($cache[$fid])) {
    $cache[$fid] = db_query("SELECT * FROM {uc_files} WHERE fid = :fid", array(
      ':fid' => $fid,
    ))
      ->fetchObject();
  }
  return $cache[$fid];
}