You are here

function _auditfiles_managed_not_used_batch_delete_process_file in Audit Files 7.4

Same name and namespace in other branches
  1. 7.3 auditfiles.managednotused.inc \_auditfiles_managed_not_used_batch_delete_process_file()

Deletes the specified file from the file_managed table.

Parameters

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

1 call to _auditfiles_managed_not_used_batch_delete_process_file()
_auditfiles_managed_not_used_batch_delete_process_batch in ./auditfiles.managednotused.inc
The batch process for deleting the file.

File

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

Code

function _auditfiles_managed_not_used_batch_delete_process_file($file_id) {
  $num_rows = db_delete('file_managed')
    ->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_managed 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_managed_not_used_files_to_display', array());
    unset($rows[$file_id]);
    variable_set('auditfiles_managed_not_used_files_to_display', $rows);
  }
}