Open ju1ius opened 11 years ago
cd /some/dir composer.phar init composer.phar require henrikbjorn/lurker dev-master mkdir -p test/foo touch test/foo/{bar,baz}.txt vim test.php
// test.php require_once __DIR__.'/vendor/autoload.php'; use Lurker\Event\FilesystemEvent; use Lurker\ResourceWatcher; $watcher = new ResourceWatcher(); $watcher->track('test.foo', __DIR__.'/test/foo'); $watcher->addListener('test.foo', function(FilesystemEvent $event) { echo $event->getTypeString() . ' >>> ' . $event->getResource() .PHP_EOL; }); $watcher->start();
t1 $ php test.php t2 $ echo "something" > test/foo/bar.txt t1 > modify >>> [..]/test/foo/bar.txt t2 $ mv test/foo/bar.txt test/ t1 > delete >> [..]/test/foo/bar.txt t2 $ mv test/bar.txt test/foo/ t1 > ... # nothing ! t2 $ rm test/foo/bar.txt t1 > ... # nothing ! t2 $ touch test/foo/bar.txt t1 > create >> [..]/test/foo/bar.txt
t1 $ inotifywait -rm test/foo t2 $ echo "something" > test/foo/bar.txt t1 > test/foo/ MODIFY bar.txt > test/foo/ OPEN bar.txt > test/foo/ MODIFY bar.txt > test/foo/ CLOSE_WRITE,CLOSE bar.txt t2 $ mv test/foo/bar.txt test/ t1 > test/foo/ MOVED_FROM bar.txt t2 $ mv test/bar.txt test/foo/ t1 > test/foo/ MOVED_TO bar.txt t2 $ rm test/foo/bar.txt t1 > test/foo/ DELETE bar.txt t2 $ touch test/foo/bar.txt t1 > test/foo/ CREATE bar.txt > test/foo/ OPEN bar.txt > test/foo/ ATTRIB bar.txt > test/foo/ CLOSE_WRITE,CLOSE bar.txt
It seems Lurker is missing two events here. IN_MOVED_FROM (FilesystemEvent::DELETE) and IN_MOVED_TO (FilesystemEvent::CREATE). Tested with pecl-inotify 0.1.6
$ php -i | grep inotify -A 2 > inotify > > Version => 0.1.1
Would it be possible for you to maybe create a testcase that can be run on Travis? i dont have inotify installed.
Steps to reproduce:
Setup test directory
Setup test script
Open two terminals, t1 & t2
Same session with inotifywait
Conclusion
It seems Lurker is missing two events here. IN_MOVED_FROM (FilesystemEvent::DELETE) and IN_MOVED_TO (FilesystemEvent::CREATE). Tested with pecl-inotify 0.1.6