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 #176032 is a reply to message #176027] Thu, 17 November 2011 18:54 Go to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma:
Senior Member
On 11/17/2011 10:04 AM, Simon wrote:
> 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
>

In addition to what Álvaro said, if you're doing a lot of this in your
scripts, I would suspect a database may be a better solution.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
[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: Fri Sep 20 20:35:35 GMT 2024

Total time taken to generate the page: 0.05014 seconds