You are here

function _auditfiles_not_on_server_batch_delete_process_file in Audit Files 7.4

Same name and namespace in other branches
  1. 7.3 auditfiles.notonserver.inc \_auditfiles_not_on_server_batch_delete_process_file()

Deletes the specified file from the database.

Parameters

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

1 call to _auditfiles_not_on_server_batch_delete_process_file()
_auditfiles_not_on_server_batch_delete_process_batch in ./auditfiles.notonserver.inc
The batch process for deleting the file.

File

./auditfiles.notonserver.inc, line 492
Generates a report showing files in the database, but not on the server.

Code

function _auditfiles_not_on_server_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_not_on_server_files_to_display', array());
    unset($rows[$file_id]);
    variable_set('auditfiles_not_on_server_files_to_display', $rows);
  }
}