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.
Drupal\file\File $file: The file that is about to be deleted.
Drupal\file\FileStorageController::delete()
upload_file_delete()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
function hook_file_predelete(Drupal\file\File $file) {
// Delete all information associated with the file.
db_delete('upload')
->condition('fid', $file->fid)
->execute();
}