> I have looked over http://us2.php.net/
> manual/en/function.stream-wrapper-register.php
> and I am trying to write a class that will
> allow everything that you can do to a system
> file to be done with content in a database.
> I think this is the proper function to use
> for that but would like a little input first.
>
Yes, this is the proper function.  However, because this is one of PHP5's
moving targets, the documentation is lagging a touch behind.


> My question is will this work all of the
> PHP functions from http://us2.php.net/
> manual/en/ref.filesystem.php:
>
Not all....

stat related functions (such as isfile() fileexists() filesize() ) will be
routed through function class: wrapperclass->url_stat($path).  It should
return an array as similar as possible to the array returned by the normal
filesystem function stat().  (Indeed calling
"stat('mywrapper://path/to/file')" is precisely what will call into
wrapperclass->url_stat() )

The stat code is a bit tricky though and the related functions (including
filesize() which you asked about) have not yet been routed through the
userspace wrappers (or any wrappers for that matter).

touch() is not yet scheduled to be routed via wrappers but your question
should spawn a discussion of that on [EMAIL PROTECTED]

unlink() is the one which you asked about which is already routed and
working in PHP5.  When unlink('yourwrapper://path/to/file');  is called,
the system will locate your class (assuming its properly registered) and
call: yourclass->unlink('/path/to/file');  your unlink method should
handle the request appropriately then return TRUE or FALSE as appropriate
to indicate success.

If you know C, you may want to look at ext/standard/ftp_fopen_wrapper.c
for an example of how wrapper-unlinking is used with URLs.  This wrapper
also has a limited implementation of url_stat() for returning filesize of
a file on a remote ftp server, however since the stat calls havn't been
routed yet (as stated above) it's never actually called... yet....

That said, I could have sworn I had added the unlink method to the
documentation, but I don't see it there.... Look for it in the next manual
build.

-Sara



-- 
PHP Documentation Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to