Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #3822
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Re: Prevent unlink(...) warning |
| Date | 2011-11-17 13:54 -0500 |
| Organization | A noiseless patient Spider |
| Message-ID | <ja3l8u$hi2$1@dont-email.me> (permalink) |
| References | <9ikm3eFih4U1@mid.individual.net> |
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@attglobal.net
==================
Back to comp.lang.php | Previous | Next — Previous in thread | Find similar | Unroll thread
Prevent unlink(...) warning Simon <bad@example.com> - 2011-11-17 17:04 +0200
Re: Prevent unlink(...) warning The Natural Philosopher <tnp@invalid.invalid> - 2011-11-17 15:18 +0000
Re: Prevent unlink(...) warning Simon <bad@example.com> - 2011-11-17 19:21 +0200
Re: Prevent unlink(...) warning The Natural Philosopher <tnp@invalid.invalid> - 2011-11-17 18:29 +0000
Re: Prevent unlink(...) warning "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> - 2011-11-17 18:42 +0100
Re: Prevent unlink(...) warning Jerry Stuckle <jstucklex@attglobal.net> - 2011-11-17 13:54 -0500
csiph-web