You are here

function _uc_file_log_download in Ubercart 6.2

Same name and namespace in other branches
  1. 7.3 uc_file/uc_file.pages.inc \_uc_file_log_download()

Processes a file download.

1 call to _uc_file_log_download()
_uc_file_download_transfer in uc_file/uc_file.pages.inc
Sends the file's binary data to a user via HTTP and updates the uc_file_users table.

File

uc_file/uc_file.pages.inc, line 361
File menu items.

Code

function _uc_file_log_download($file_user, $ip) {

  // Add the address if it doesn't exist.
  $addresses = $file_user->addresses;
  if (!in_array($ip, $addresses)) {
    $addresses[] = $ip;
  }
  $file_user->addresses = $addresses;

  // Accessed again.
  $file_user->accessed++;

  // Calculate hash
  $file_user->file_key = drupal_get_token(serialize($file_user));
  drupal_write_record('uc_file_users', $file_user, 'fuid');
}