gocom / danpu

Optimized MySQL dump library written in PHP
MIT License
62 stars 15 forks source link

Remove cache file if backup returns an error #13

Open tvb opened 10 years ago

tvb commented 10 years ago

I noticed danpu will place files of 0 bytes (i.e.: Rah_Danpu_CpCOO0) in the temporary folder if the backup fails for any reason (like unable to connect). Those should be removed to keep the working directory clean.

tvb commented 10 years ago

Hmm, seems https://github.com/gocom/danpu/blob/master/src/Rah/Danpu/Base.php#L223 is not called in case of a failure?

gocom commented 10 years ago

The clean up is called on shutdown process via destructor method. The only case when it won't be called should be when the process dies on a FATAL error (e.g. when one doesn't capture exceptions, or the process terminates unexpectedly before normal shutdown) or other member in the shutdown chain kills the process.

tvb commented 10 years ago

Not sure why the tmp files remain then. I will see if I can reproduce the issue.

tvb commented 10 years ago

Or unable to connect is treated as FATAL?