Em Mon, 07 Mar 2011 01:15:47 -0000, Stas Malyshev <smalys...@sugarcrm.com> escreveu:

PHP file streams provide very powerful and useful abstraction layer over the I/O-related functions. However, there's a group of functions which are excluded from this support - namely, touch(), chmod(), chown() and chgrp() - i.e., functions dealing with file metadata. This lead to libraries implementing FS virtualization developing various hacks, such as here:
https://code.google.com/p/bovigo/wiki/vfsStreamDocsFilemode
I propose to plug this hole in the stream implementation by adding a handler to deal with metadata to stream handlers, such as:

int (*stream_set_metadata)(php_stream_wrapper *wrapper, char *url, int metatype, void *metadata TSRMLS_DC);

metadata types can be:
- access/modification time with touch() semantics or without it
- permissions information
- owner information by name or number
- group information by name or number

Of course, there are streams where it doesn't make sense, but there are many application of streams (such as virtualizing real filesystems, mocks, etc.) where this would help a lot with using streams transparently inside applications.
Any comments?

It's a good idea.

But what about getting the metadata (as opposed to setting it)? I understand reading most of this stuff is already covered by the stat handler, but what about for example NTFS/POSIX ACLs or reading reparse point data? It would be nice to have a way to retrieve them. One might as well add two handlers.


--
Gustavo Lopes

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

Reply via email to