Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:65868 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 14250 invoked from network); 15 Feb 2013 12:50:58 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Feb 2013 12:50:58 -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:49558] helo=host1.trois-doubles.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 04/41-06160-E2F2E115 for ; Fri, 15 Feb 2013 07:50:56 -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 E409B20A9D2 for ; Fri, 15 Feb 2013 13:50:50 +0100 (CET) Message-ID: <511E2F2A.3030804@hoa-project.net> Date: Fri, 15 Feb 2013 13:50:50 +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> <511E1F6E.7030607@suumit.com> In-Reply-To: <511E1F6E.7030607@suumit.com> Content-Type: text/plain; charset=windows-1252; 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 Victor, On 15/02/13 12:43, Victor Berchet wrote: > > On 02/14/2013 03:03 PM, Ivan Enderlin @ Hoa wrote: >> Hi internal, >> >> A missing feature in PHP is a file system watcher/monitoring=20 >> available for almost all platforms. On Linux, we have inotify=20 >> (available in PHP through pecl/inotify), on Mac OS X, we have=20 >> /dev/fsevents (not available in PHP, since we need ioctl to do that=20 >> in pure PHP =97and sudo=97, no C extension needed), on FreeBSD, we hav= e=20 >> FAM, and on Windows, we have FileSystemWatcher in .NET. All major=20 >> platforms have a solution ready to use. >> >> By now, if we didn't use these solutions, we should use a finder=20 >> (thanks to RecursiveIteratorIterator and DirectoryIterator in SPL)=20 >> that runs every n seconds and compute a diff with the previous run.=20 >> 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=20 >> allows it)? or do you want such a feature? >> >> Best regards :-). >> > Ivan, > > Everzet has started to build a client side solution[1] > > Hopefuly he will have time to update the PR with what is remaining to=20 > do soon[2] I have read your conversation on Twitter. Everzet uses inotify or a=20 recursiveiterator as a fallback, as suggested in my first mail, but this = cannot be extended to FSEvents, FAM etc. A solution in pure PHP is not=20 possible for technical reasons (we need ioctl to read from=20 /dev/fsevents, or we need a low-level C program for Windows, BSD etc.).=20 That's my point here :-). Of course, =93tricky=94 solutions exist on the Web, like the one proposed= by=20 Everzet. I did one and you can find many others, but they are=20 =93incomplete=94 or =93unefficient=94 most of the times (note the quotes = here,=20 it depends of the context of use). Cheers. --=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/