From b6e44a116d039894fb85b4ab79f1d2f481f16f6a Mon Sep 17 00:00:00 2001 From: UrbanCMC Date: Sat, 20 Feb 2016 18:54:48 +0100 Subject: [PATCH] Support INotifyWait CREATE event INotifyWait's CLOSE_WRITE and MOVED_TO events don't work on all operating systems. For those, the CREATE event looks like the best option. --- app/Libraries/WatchRecord/InotifyWatchRecord.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/Libraries/WatchRecord/InotifyWatchRecord.php b/app/Libraries/WatchRecord/InotifyWatchRecord.php index 72a5570c..d1cf2831 100644 --- a/app/Libraries/WatchRecord/InotifyWatchRecord.php +++ b/app/Libraries/WatchRecord/InotifyWatchRecord.php @@ -40,7 +40,8 @@ class InotifyWatchRecord extends WatchRecord implements WatchRecordInterface /** * Determine if the object has just been created or modified. - * For our purpose, we DON'T watch the CREATE event, because CLOSE_WRITE should be enough. + * For our purpose, we watch both the CREATE abd the CLOSE_WRITE event, because some operating + * systems only support CREATE, but not CLOSE_WRITE and MOVED_TO. * Additionally, a MOVED_TO (occurred after the object has been moved/renamed to another location * **under our watched directory**) should be considered as "modified" also. * @@ -48,7 +49,7 @@ class InotifyWatchRecord extends WatchRecord implements WatchRecordInterface */ public function isNewOrModified() { - return $this->eventExists('CLOSE_WRITE') || $this->eventExists('MOVED_TO'); + return $this->eventExists('CLOSE_WRITE') || $this->eventExists('CREATE') || $this->eventExists('MOVED_TO'); } /**