function uc_file_get_by_key in Ubercart 6.2
Same name and namespace in other branches
- 8.4 uc_file/uc_file.module \uc_file_get_by_key()
- 7.3 uc_file/uc_file.module \uc_file_get_by_key()
Retrieves a file by hash key.
Parameters
$key: A hash key.
Return value
A uc_file object.
1 call to uc_file_get_by_key()
- _uc_file_download in uc_file/
uc_file.pages.inc - Handles file downloading and error states.
File
- uc_file/
uc_file.module, line 1664
Code
function &uc_file_get_by_key($key) {
$cache = _uc_file_get_cache();
if (!isset($cache[$key])) {
$cache[$key] = db_fetch_object(db_query("SELECT * FROM {uc_file_users} ufu " . "LEFT JOIN {uc_files} uf ON uf.fid = ufu.fid " . "WHERE ufu.file_key = '%s'", $key));
$cache[$key]->addresses = unserialize($cache[$key]->addresses);
}
return $cache[$key];
}