function hook_file_delete

7.x system.api.php hook_file_delete($file)

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 drupal-7.x/modules/simpletest/tests/entity_crud_hook_test.module
Implements hook_file_delete().
file_file_delete in drupal-7.x/modules/file/file.module
Implements hook_file_delete().
file_test_file_delete in drupal-7.x/modules/simpletest/tests/file_test.module
Implements hook_file_delete().
image_file_delete in drupal-7.x/modules/image/image.module
Implements hook_file_delete().
user_file_delete in drupal-7.x/modules/user/user.module
Implements hook_file_delete().
1 invocation of hook_file_delete()
file_delete in drupal-7.x/includes/file.inc
Deletes a file and its database record.

File

drupal-7.x/modules/system/system.api.php, line 2898
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();
}