[development] Files on previews

James Walker walkah at walkah.net
Fri Nov 11 03:18:44 UTC 2005

On 11/10/05 7:27 PM, Richard Archer wrote:
> At 1:12 AM +0100 11/11/05, Ber Kessels wrote:
>> Why did we choose for the current method of writing all the exceptions for
>> previews? Did I miss something important that renders my idea impossible?
>> Should I take care of something else?
> I'm not a files guru, but I'll offer a suggestion.
> What happens if the user:
> clicks "create new page"
> attaches a file
> clicks preview
> goes and has a cup of coffee and their Windoze box crashes.
> You're left with a file dangling in the file system which
> should really be deleted, perhaps by a weekly cron.
> But because you have now fully inserted this file into the
> file system there's no easy way of telling if it's really
> required or not.

Indeed, this is the whole reason that image.module has it's own temp 
directory - which is really just a scratch area where we can generate 
thumbnails, etc ... have them in the files directory so that they can be 
accessed by file_create_url() ... but they're also segmented exactly so 
that image_cron() can clean them up later in exactly the scenario you 
bring up (something happens between previews and submit ... leaving 
dangling files).

Image makes no database entries until submit (as per usual).

I won't go so far as to say maybe upload.module should do something 
similar... ;)
James Walker :: http://walkah.net/ :: xmpp:walkah at walkah.net

More information about the development mailing list