1 system.api.php | hook_file_predelete(File $file) |
Act prior to file deletion.
This hook is invoked when deleting a file before the file is removed from the filesystem and before its records are removed from the database.
Parameters
File $file: The file that is about to be deleted.
See also
FileStorageController::delete()
upload_file_delete()
Related topics
File
- core/
modules/ system/ system.api.php, line 2416 - Hooks provided by Backdrop core and the System module.
Code
function hook_file_predelete(File $file) {
// Delete all information associated with the file.
db_delete('upload')->condition('fid', $file->fid)->execute();
}