Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:65870 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 17631 invoked from network); 15 Feb 2013 13:07:28 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Feb 2013 13:07:28 -0000 Authentication-Results: pb1.pair.com header.from=ivan.enderlin@hoa-project.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=ivan.enderlin@hoa-project.net; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain hoa-project.net from 95.130.12.24 cause and error) X-PHP-List-Original-Sender: ivan.enderlin@hoa-project.net X-Host-Fingerprint: 95.130.12.24 host1.trois-doubles.net Linux 2.6 Received: from [95.130.12.24] ([95.130.12.24:52966] helo=host1.trois-doubles.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1E/E1-06160-9033E115 for ; Fri, 15 Feb 2013 08:07:22 -0500 Received: from Hwhost2.local (158-63.203-62.cust.bluewin.ch [62.203.63.158]) by host1.trois-doubles.net (Postfix) with ESMTPSA id A42A120A9D2 for ; Fri, 15 Feb 2013 14:07:18 +0100 (CET) Message-ID: <511E3305.2020506@hoa-project.net> Date: Fri, 15 Feb 2013 14:07:17 +0100 Reply-To: ivan.enderlin@hoa-project.net User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:20.0) Gecko/20100101 Thunderbird/20.0a2 MIME-Version: 1.0 To: internals@lists.php.net References: <511CEEB1.7040303@hoa-project.net> <511D5924.4070602@sugarcrm.com> In-Reply-To: <511D5924.4070602@sugarcrm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] File system watcher/monitoring From: ivan.enderlin@hoa-project.net ("Ivan Enderlin @ Hoa") 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 availab= le >> in PHP, since we need ioctl to do that in pure PHP =E2=80=94and sudo=E2= =80=94, no C >> extension needed), on FreeBSD, we have FAM, and on Windows, we have >> FileSystemWatcher in .NET. All major platforms have a solution ready t= o 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=20 would like to re-run or re-generate tests. In this case, you have a=20 daemon that watches files changes and executes a command when needed. Another more concrete example is with EventSource [1]. The browser=20 maintains opened a connection and the server writes on this connection=20 step-by-step (or=E2=80=A6 chunk-by-chunk since it uses the chunk feature = of=20 HTTP1.1). It is very useful to develop some =E2=80=9Crealtime-tools=E2=80= =9D. I made a=20 video [2] to illustrate (code is here [3]). This is very naive and not=20 optimized at all, but this is a short POC to show you an interesting=20 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/ [2] https://dl.dropbox.com/u/26317193/Realtime_edition.webm [3] http://paste.hoa-project.net/9f15189c05ef0961d374fe7e6c70b3b2b27c8b64= --=20 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/