FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Prevent unlink(...) warning
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Prevent unlink(...) warning [message #176028 is a reply to message #176027] Thu, 17 November 2011 15:18 Go to previous messageGo to previous message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma:
Senior Member
Simon wrote:
> Hi,
>
> I am having some race condition issues on my server when trying to
> delete a file.
>

what makes you think its a race condition?

> //
> function my_unlink( $filename )
> {
> // remove the old file
> clearstatcache(TRUE, $filename);
> if (file_exists($filename))
> {
> @unlink($filename);
> }
> else
> {
> return true;
> }
>
> clearstatcache(TRUE, $filename);
> return (!file_exists($filename)); // check it was deleted.
> }
> //
>

Why do you care about the stat cache?

> In some cases I get
>
> unlink(/home/xxx/public_html/temp/yyy.zz) [function.unlink]: No such
> file or directory
>
> How can I prevent the warning?
>
Why prevent it at all?

As long as the file is not there when you are finished - why not just
unlink it anyway?

> Thanks
>
> Simon
>
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Embedding HTML Within a PHP Statement
Next Topic: Re: comp.lang.php forum
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 10 17:15:53 GMT 2024

Total time taken to generate the page: 0.08821 seconds