RE: new error checking
| From: | boots | Date: | Fri, 30 May 2003 21:59:29 +0000 |
| Subject: | RE: new error checking | ||
| References: | 1 | Groups: | php.smarty.dev |
| Request: | Send a blank email to php-smarty-dev+get-1524@lists.php.net to get a copy of this message | ||
> If we want the normal process to fail first, it would have to
> continue into the write_file() routine, then return a failure,
> then unravel the typically deep directory structure it was trying
> to write, figure out the appropriate error, etc.
Is it not true that you can't know that there is a problem until you
actually try to write the file since the directory structure may not
exist yet? So you would have to do your checks, then if they fail,
you'd have to TRY to write the directories and then the file. If THOSE
fail, then you are back to having to say that the process failed again.
So why not just attempt the process and then report the status? One way
or another, you may have to unwind part of the operation.
> Also, I think the is_writable() information will already be cached by
> PHP at this point since the file was already attempated to be read
> from there. I could be wrong though :-)
I think you are right, which I think implies that you'd have to clear
the PHP stat cache for all files to get the correct result in the case
that the directory didn't exist yet.
ASIDE:
Is there any reason that use_sub_dirs logic can't be changed to the
following:
- if create sub dirs fails issue a but silently set use_sub_dirs =
false and try again.
__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com