function uc_file_get_by_key in Ubercart 7.3
Same name and namespace in other branches
- 8.4 uc_file/uc_file.module \uc_file_get_by_key()
- 6.2 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.
File
- uc_file/
uc_file.module, line 1538 - Allows products to be associated with downloadable files.
Code
function &uc_file_get_by_key($key) {
$cache = _uc_file_get_cache();
if (!isset($cache[$key])) {
$cache[$key] = db_query("SELECT * FROM {uc_file_users} ufu " . "LEFT JOIN {uc_files} uf ON uf.fid = ufu.fid " . "WHERE ufu.file_key = :key", array(
':key' => $key,
))
->fetchObject();
$cache[$key]->addresses = unserialize($cache[$key]->addresses);
}
return $cache[$key];
}