You are here

function hook_file_delete in Drupal 7

Respond to a file being deleted.

Parameters

$file: The file that has just been deleted.

See also

file_delete()

Related topics

5 functions implement hook_file_delete()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

entity_crud_hook_test_file_delete in modules/simpletest/tests/entity_crud_hook_test.module
Implements hook_file_delete().
file_file_delete in modules/file/file.module
Implements hook_file_delete().
file_test_file_delete in modules/simpletest/tests/file_test.module
Implements hook_file_delete().
image_file_delete in modules/image/image.module
Implements hook_file_delete().
user_file_delete in modules/user/user.module
Implements hook_file_delete().
1 invocation of hook_file_delete()
file_delete in includes/file.inc
Deletes a file and its database record.

File

modules/system/system.api.php, line 2984
Hooks provided by Drupal core and the System module.

Code

function hook_file_delete($file) {

  // Delete all information associated with the file.
  db_delete('upload')
    ->condition('fid', $file->fid)
    ->execute();
}