[development] Allow existing files to be attached

Darrel O'Pry dopry at thing.net
Thu Dec 6 18:55:16 UTC 2007

No, but you could have reviewed the hook_file patch several months ago,
when there was still a chance for it to get into D6.

http://drupal.org/node/142995 which I have even been keeping up to date
with head if you want to review it now...

On Thu, 2007-12-06 at 19:38 +0100, Philippe Jadin wrote:
> 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