file streams & metadata
| From: | Stas Malyshev | Date: | Mon, 07 Mar 2011 01:15:47 +0000 |
| Subject: | file streams & metadata | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-51582@lists.php.net to get a copy of this message | ||
Hi!
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?
--
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227