[development] Tmp directory

Darrel O'Pry darrel.opry at gmail.com
Fri Jul 11 23:28:21 UTC 2008


Just a note for developers who write modules that create temporary files...

I've found that a register_shutdown_function('file_delete',
realpath($path_to_file)) is pretty dependable for cleaning up... note the
use of realpath, it's necessary for shutdown functions
and file_delete has the file_exists check in it to prevent errors in the
shutdown phase..

.darrel.

On Fri, Jul 11, 2008 at 5:43 AM, Miriam Natanzon <miriam at mail.snunit.k12.il>
wrote:

> Thanks for your all responses!
>
> I'm using Drupal 5.7, and understood Drupal core and also Drupal cron
> didn't
> take care of that issue of deleting old unused files from Tmp...
> I think it's the right place because I didn't expect Drupal to fix it in
> this version and wonder if someone develop a script fix it.
> I saw there files with "tmp_" prefix (machine names) and also files with
> human-names.
> ( Someone guessed there is an module that upload files and didn't care of
> deleting the temporary files, It's can be the audio module in my site.. )
>
>
>
> Miriam.
>
>
> -----Original Message-----
> From: development-bounces at drupal.org
> [mailto:development-bounces at drupal.org]On Behalf Of mark burdett
> Sent: Thursday, July 10, 2008 7:44 PM
> To: development at drupal.org
> Subject: Re: [development] Tmp directory
>
> I'm guessing this issue is re: Drupal 5, but in Drupal 6 there is an
> over-zealous temp file cleanup, it only allows them to stick around
> for 24 minutes. http://drupal.org/node/276018
>
> --mark
>
> On Thu, Jul 10, 2008 at 9:30 AM, Morbus Iff <morbus at disobey.com> wrote:
> >>> It is a development request to the extent that this may be a "bug by
> >>> design"; what is supposed to happen to the tmp files? Are people who
> may
> >>> not
> >>> be system admin gurus supposed to know that these files accumulate, and
> >>> what
> >>> to do with them?
> >>
> >> But the OP didn't raise a development topic; it was a topic of support.
> >> There is a different list for that.
> >
> > I'm on the fence. Largely:
> >
> >  * if Drupal is leaving tmp files around, something has gone wrong
> >   at a high enough level that we probably /can't/ "fix it" by
> >   removing the temp files.
> >
> >  * most servers have a tmpwatch utility of some kind that automatically
> >   purges left over files. This, of course, presumes that Drupal's temp
> >   directory remains at the default /tmp. If it's moved elsewhere, then
> >   Drupal becomes responsible for cleaning up the files (and we'd
> >   probably want to implement some sort of post-cleanup in a cron).
> >
> > --
> > Morbus Iff ( and think about the bad things that I didn't do )
> > Technical: http://www.oreillynet.com/pub/au/779
> > Enjoy: http://www.disobey.com/ and http://www.videounderbelly.com/
> > aim: akaMorbus / skype: morbusiff / icq: 2927491 / jabber.org: morbus
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20080711/4aec0d3a/attachment.htm 


More information about the development mailing list