You are here

function _auditfiles_not_in_database_batch_delete_process_file in Audit Files 7.4

Same name and namespace in other branches
  1. 7.3 auditfiles.notindatabase.inc \_auditfiles_not_in_database_batch_delete_process_file()

Deletes the specified file from the server.

Parameters

string $filename: The full pathname of the file to delete from the server.

1 call to _auditfiles_not_in_database_batch_delete_process_file()
_auditfiles_not_in_database_batch_delete_process_batch in ./auditfiles.notindatabase.inc
The batch process for deleting the file.

File

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

Code

function _auditfiles_not_in_database_batch_delete_process_file($filename) {

  // Delete the file without invoking any hooks.
  if (file_unmanaged_delete($filename)) {
    drupal_set_message(t('Sucessfully deleted %file from the server.', array(
      '%file' => $filename,
    )));

    // Remove the deleted files from the list of files to display.
    $rows = variable_get('auditfiles_not_in_database_files_to_display', array());
    unset($rows[$filename]);
    variable_set('auditfiles_not_in_database_files_to_display', $rows);
  }
  else {
    drupal_set_message(t('Failed to delete %file from the server.', array(
      '%file' => $filename,
    )));
  }
}