The streams API has, since early in its introduction had the capacity to
perform stat() family calls on files under any wrapper.

In theory.

What's preventing wrapper->wops->url_stat from being useful is that the code
in ext/standard/filestat.c has never been routed through this layer.

I've put together a patch at http://169.229.139.97/test/stat-streams.diff to
accomplish this and it seems to test well with local files, local symlinks,
and remote ftp files (the ftp wrapper has had a limited url_stat method
waiting to be used for some months now).

However, since the stat() related code does a little voodoo in terms of
caching results and handling multiple function calls in a single do-all, I'd
like to get feedback from others on its suitability.

Also, this patch extends the stream_wrapper_ops structure slightly by adding
an access_check() method (for is_readable(), is_writeable(), etc...)

url_stat() and access_check() are both implemented in the plainfiles wrapper
with this path.

The ugliest part of this patch is that it requires special treatment for the
plainfiles wrapper in order to deal with symlink stat calls.  An alternative
(and it wouldn't take much to convince me to go the other way) would be to
add a parameter to the url_stat() method to indicate if the stat is a
symlink_stat.

Look forward to your thoughts.

-Sara



-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to