You are here

function _auditfiles_used_not_managed_batch_delete_process_file in Audit Files 7.4

Same name and namespace in other branches
  1. 7.3 auditfiles.usednotmanaged.inc \_auditfiles_used_not_managed_batch_delete_process_file()

Deletes the specified file from the file_usage table.

Parameters

int $file_id: The ID of the file to delete from the database.

1 call to _auditfiles_used_not_managed_batch_delete_process_file()
_auditfiles_used_not_managed_batch_delete_process_batch in ./auditfiles.usednotmanaged.inc
The batch process for deleting the file.

File

./auditfiles.usednotmanaged.inc, line 482
Generates a report showing files in file_usage, but not in file_managed.

Code

function _auditfiles_used_not_managed_batch_delete_process_file($file_id) {
  $num_rows = db_delete('file_usage')
    ->condition('fid', $file_id)
    ->execute();
  if (empty($num_rows)) {
    drupal_set_message(t('There was a problem deleting the record with file ID %fid from the file_usage table. Check the logs for more information.', array(
      '%fid' => $file_id,
    )), 'warning');
  }
  else {

    // Remove the deleted files from the list of files to display.
    $rows = variable_get('auditfiles_used_not_managed_files_to_display', array());
    unset($rows[$file_id]);
    variable_set('auditfiles_used_not_managed_files_to_display', $rows);
  }
}