Hello all,

I do not know if this is the right place to post a question about this. I am
trying to figure out what all I can do using stream_wrapper_register
functions.

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.

The link above states

stream_wrapper_register() allows you to implement your own protocol handlers
and streams for use with all the other filesystem functions (such as
fopen(), fread() etc.).

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

example:

filesize -- Gets file size
touch -- Sets access and modification time of file
unlink -- Deletes a file

and too many more to list

first few lines of code sample at
http://us2.php.net/manual/en/ref.filesystem.php:

class VariableStream {
    var $position;
    var $varname;

    function stream_open($path, $mode, $options, &$opened_path)
    {
        $url = parse_url($path);
        $this->varname = $url["host"];
        $this->position = 0;

        return true;
    }


If so would they need to be wrote like this?

    function stream_filesize($path, $mode, $options, &$opened_path)
    {
// put sql here
        return true;
    }

    function stream_touch($path, $mode, $options, &$opened_path)
    {
// put sql here
        return true;
    }

    function stream_unlink($path, $mode, $options, &$opened_path)
    {
// put sql here
        return true;
    }

and so forth

Thanks,

Larry E. Masters
aka PhpNut



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

Reply via email to