Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:3848 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 95045 invoked by uid 1007); 10 Aug 2003 00:30:52 -0000 Message-ID: <20030810003052.95044.qmail@pb1.pair.com> To: internals@lists.php.net Reply-To: Date: Sat, 9 Aug 2003 17:27:22 -0700 Lines: 34 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Posted-By: 64.142.6.231 Subject: [Review] Route stat() family of calls via wrapper ops. From: pollita@php.net 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