Re: File system watcher/monitoring
| From: | Mike Ho | Date: | Thu, 14 Feb 2013 14:18:03 +0000 |
| Subject: | Re: File system watcher/monitoring | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-65823@lists.php.net to get a copy of this message | ||
Just a quick note, FileSystemWatcher in .NET is actually not recommended for use by Microsoft.
It does not guarantee that an event will be raised on every new file or file mod in a given
folder… and it's even less determinstic when trying to deal with network share drives.
Microsoft's own developer blogs usually recommend that people roll their own polling-based
solution instead of depending on FileSystemWatcher (googling FileSystemWatcher will yield many many
results regarding this).
I'm not necessarily saying that the overall idea is without merit… but it's just that if
someone does want to try and implement something like this on Windows, they should try and avoid
whatever Win32 API calls that FileSystemWatcher uses.
--Mike
On Feb 14, 2013, at 6:03 AM, Ivan Enderlin @ Hoa <ivan.enderlin@hoa-project.net> wrote:
> Hi internal,
>
> A missing feature in PHP is a file system watcher/monitoring available for almost all
> platforms. On Linux, we have inotify (available in PHP through pecl/inotify), on Mac OS X, we have
> /dev/fsevents (not available in PHP, since we need ioctl to do that in pure PHP —and sudo—, no C
> extension needed), on FreeBSD, we have FAM, and on Windows, we have FileSystemWatcher in .NET. All
> major platforms have a solution ready to use.
>
> By now, if we didn't use these solutions, we should use a finder (thanks to
> RecursiveIteratorIterator and DirectoryIterator in SPL) that runs every n seconds and compute a diff
> with the previous run. This solution works fine for a small set of files but it can slow for a big
> one. This is just a tricky solution, not a proper one.
>
> Possible domains where it is needed: test, CI, log, file transfering, security etc.
>
> Is it possible to have such a feature landing in PHP (core if karma allows it)? or do you want
> such a feature?
>
> Best regards :-).
>
> --
> Ivan Enderlin
> Developer of Hoa
> http://hoa-project.net/
>
> PhD. student at DISC/Femto-ST (Vesontio) and INRIA (Cassis)
> http://disc.univ-fcomte.fr/ and
> http://www.inria.fr/
>
> Member of HTML and WebApps Working Group of W3C
> http://w3.org/
>
>
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>