Delete FileField Content when field is deleted.

joachim - April 14, 2008 - 16:08
Project:FileField
Version:6.x-3.x-dev
Component:Code
Category:task
Priority:normal
Assigned:Unassigned
Status:active
Description

CCK: 5.x-1.6-1
Imagefield: 5.x-1.1

I had one image field on my site, set on one content type.

I deleted the field.
I expected the image files uploaded to this field to be deleted from my server's directory, but they are still there.

#1

dopry - April 20, 2008 - 03:20
Title:image files not deleted when field is deleted» Delete Imagefield Content when field is deleted. New CCK hook required.
Version:5.x-1.1» 6.x-3.x-dev
Category:bug report» task
Status:active» postponed

Yeah CCK doesn't let modules know this is happening... CCK will have to be updated upstream I can probably put something in place after the 6.x ports are done.

#2

quicksketch - March 12, 2009 - 22:17
Title:Delete Imagefield Content when field is deleted. New CCK hook required.» Delete FileField Content when field is deleted.
Project:ImageField» FileField
Version:6.x-3.x-dev» 6.x-3.x-dev
Status:postponed» active

We can now do this with CCK 2.x in Drupal 6. Here's the relevant code from content_field_instance_delete():

<?php
 
// Invoke hook_content_fieldapi().
 
module_invoke_all('content_fieldapi', 'delete instance', $field);
?>

Moving to FileField since it controls storing the files.

#3

Earl Grey - September 10, 2009 - 20:57

subscribing

#4

mecvo1984 - November 9, 2009 - 01:59

Just upgraded from the Alpha version of this today to 6.x-3.2. In the alpha version if a file was removed, it was also deleted from the server as well. This is not the case with the latest module. This is causing problems with the View I set up. The file should be deleted from the view (like it was in the Alpha version) but it is not.

 
 

Drupal is a registered trademark of Dries Buytaert.