libsmbclient-php icon indicating copy to clipboard operation
libsmbclient-php copied to clipboard

Add support for smbclient_notify

Open icewind1991 opened this issue 10 years ago • 6 comments
trafficstars

The smbclient notify command allows clients to get notified whenever a file or folder is changed on the server.

From what I can tell this functionality is exposed as smbc_setFunctionNotify in libsmbclient in newer versions of smbclient

icewind1991 avatar Sep 21 '15 14:09 icewind1991

hmm, ok, I will try to take a look at this soon, a bit busy this week as I will move next week.

eduardok avatar Sep 22 '15 15:09 eduardok

smbc_notify was added to libsmbclient.h on June 26, 2015. I wonder how it should be implemented for PHP, since the notifications come asynchronously through callbacks. You'd have to register a PHP callback function with the library.

aklomp avatar Sep 23 '15 06:09 aklomp

I think such callback make sense in long running process (CLI), not really in web env.

remicollet avatar Sep 23 '15 06:09 remicollet

Well, it would be nice if it kept the notifications on a queue for later consumption (with a configurable timeout, etc), but that means more code in samba :P What options do we have ?

eduardok avatar Sep 23 '15 16:09 eduardok

Well, PHP can also be (ab)used as a tool to write CLI programs/daemons, so adding notify support is not totally crazy. I just wonder how hard it is to hook into the PHP event loop and issue a callback. It's certainly something that I have no experience with.

aklomp avatar Sep 23 '15 17:09 aklomp

Notice: the pecl/inotify ext use the "queue" way

remicollet avatar Sep 23 '15 17:09 remicollet