Re: php fam problems
| From: | Benjamin Adler | Date: | Fri, 06 Aug 2004 22:18:46 +0000 |
| Subject: | Re: php fam problems | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-193046@lists.php.net to get a copy of this message | ||
Jay, thank you for your answer!
The fact that fam_monitor_directory is non-recursive gives me trouble since I
need to monitor a whole tree of directories and files.
I could easily traverse all subdirectories and add them to the fam resource
with fam_monitor_directory. But unfortunately, the 'file' in the array I get
from fam_next_event() contains only the file-basename, not the full path of
the file. So I'll never know where in my directory-tree the current file is.
And since there might be multiple files with the same basename in different
monitored directories, I'm stuck.
How can I monitor multiple directories and get to know exactly which file
changed? Will I have to create as many fam-resources as I have directories?
thank you!
ben adler
Am Freitag, 6. August 2004 14:40 schrieb Jay Blanchard:
> [snip]
> I'm trying to use the fam module from cli-php5 with the example code
> from
> http://de2.php.net/manual/en/ref.fam.php. It works, but when I
> copy a
> big file into an observed folder, I get a FAMCreated for the file, and
> then, while the copying is still in progress, multiple FAMChanged.
>
>
> I want to watch a folder and process the files that are either new or
> changed. Currently, I would end up processing a new or changed file n
> times,
> with n depending on the file's size. I'd like to get ONE FAMCreated for
> a
> new file AFTER it was completely created and ONE FAMChanged for a file
> AFTER a process is done changing it. Is that possible?
> [/snip]
>
> Because the stat of the file changes you will get multiple FAMChanged.
> You may have to test for a time since last FAMChanged and wait a
> suitable amount of time to take any actions on the file.
>
> [snip]
> Also, when I watch i.e. /mnt, FAM doesn't notify me of events in /mnt's
> subdirectories, the monitoring seems to be non-recursive. Can I change
> this, or will I have to fam_monitor_directory each directory separately?
> [/snip]
>
> fam_monitor_directory is non-recursive.