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
Prevent unlink(...) warning [message #176027] Thu, 17 November 2011 15:04 Go to previous message
Simon is currently offline  Simon
Messages: 29
Registered: February 2011
Karma:
Junior Member
Hi,

I am having some race condition issues on my server when trying to
delete a file.

//
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.
}
//

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?

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: Thu Nov 28 21:14:57 GMT 2024

Total time taken to generate the page: 0.06882 seconds