You are here

function _uc_file_prune_db in Ubercart 7.3

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

Removes all db entries associated with a given $fid.

3 calls to _uc_file_prune_db()
uc_file_empty in uc_file/uc_file.module
Removes all downloadable files, as well as their associations.
uc_file_remove_by_id in uc_file/uc_file.module
Deletes files (or directories).
_uc_file_prune_files in uc_file/uc_file.module
Removes non-existent files.

File

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

Code

function _uc_file_prune_db($fid) {
  $pfids = db_query("SELECT pfid FROM {uc_file_products} WHERE fid = :fid", array(
    ':fid' => $fid,
  ));
  while ($pfid = $pfids
    ->fetchField()) {
    db_delete('uc_product_features')
      ->condition('pfid', $pfid)
      ->condition('fid', 'file')
      ->execute();
    db_delete('uc_file_products')
      ->condition('pfid', $pfid)
      ->execute();
  }
  db_delete('uc_file_users')
    ->condition('fid', $fid)
    ->execute();
  db_delete('uc_files')
    ->condition('fid', $fid)
    ->execute();
}