Re: File system watcher/monitoring
| From: | Sebastian Krebs | Date: | Fri, 15 Feb 2013 13:20:53 +0000 |
| Subject: | Re: File system watcher/monitoring | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-65871@lists.php.net to get a copy of this message | ||
2013/2/15 Ivan Enderlin @ Hoa <ivan.enderlin@hoa-project.net>
> Hi Stas,
>
>
> On 14/02/13 22:37, Stas Malyshev wrote:
>
>> Hi!
>>
>> 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.
>>>
>> I think it'd be great to have a library with unified interface and an
>> extension that uses it. However, I'm not sure if these libraries are
>> useful in common php use case - short-lived requests. Could I get the
>> changes since the last request? Or is it useful only for long-running
>> persistent processes?
>>
> It is only useful for long-running processes.
>
> For example when you are writting tests: at each modifications, you would
> like to re-run or re-generate tests. In this case, you have a daemon that
> watches files changes and executes a command when needed.
>
Why do you need PHP for this?
http://stackoverflow.com/questions/3283228/bash-execute-script-on-file-save#answer-3283390
>
> Another more concrete example is with EventSource [1]. The browser
> maintains opened a connection and the server writes on this connection
> step-by-step (or… chunk-by-chunk since it uses the chunk feature of
> HTTP1.1). It is very useful to develop some “realtime-tools”. I made a
> video [2] to illustrate (code is here [3]). This is very naive and not
> optimized at all, but this is a short POC to show you an interesting
> usecase.
>
>
> Is it possible to have such a feature landing in PHP (core if karma
>>> allows it)? or do you want such a feature?
>>>
>> I'm not sure why it has to be in core though. I don't see so far
>> anything that requires modifying language core.
>>
> The core integration was a joke, forget it ;-).
>
>
> Regards.
>
> [1]
> http://www.w3.org/TR/**eventsource/<http://www.w3.org/TR/eventsource/>
> [2]
> https://dl.dropbox.com/u/**26317193/Realtime_edition.webm<https://dl.dropbox.com/u/26317193/Realtime_edition.webm>
> [3]
> http://paste.hoa-project.net/**9f15189c05ef0961d374fe7e6c70b3**
>
> b2b27c8b64<http://paste.hoa-project.net/9f15189c05ef0961d374fe7e6c70b3b2b27c8b64>
>
>
> --
> 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
>
>
--
github.com/KingCrunch