[development] Allow existing files to be attached

Philippe Jadin philippe.jadin at gmail.com
Thu Dec 6 18:38:37 UTC 2007


On Dec 6, 2007 5:44 PM, andrew morton <drewish at katherinehouse.com> wrote:
> If multiple modules are sharing a file there's no way for them to know
> that another is using it. So when a node with a file is attached is
> deleted, any other modules' nodes that are using that file will be
> left with a database record but no file.
>
> I'm not sure what changes dopry is referring to, as far as I know D6
> has the same problem. Unresolved issues on how to handle deletion were
> what held up the patch to add a hook_file:
> http://drupal.org/node/142995

I looked at upload_delete in both D5 and D6 and it seems they both
delete files when they are not attached to the node being deleted. The
rule could be changed to delete the file only if it not used in *any*
node. A module with higher priority than upload could do some magik in
the file_versions / upload table with a delete hook to avoid this.
This could work without touching core.

I think files could be made available to more than one node to avoid
uploading the same file multiple times. Is it wrong vs the Drupal
philosophy ? I'd better know before working on a module :-)

Philippe

> andrew
>


More information about the development mailing list