InotifyMonitor.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. class InotifyMonitor {
  3. const EVENT_MASK = [
  4. IN_ACCESS => 'File was accessed (read)',
  5. IN_MODIFY => 'File was modified',
  6. IN_ATTRIB => 'Metadata changed',
  7. IN_CLOSE_WRITE => 'File opened for writing was closed',
  8. IN_CLOSE_NOWRITE => 'File not opened for writing was closed',
  9. IN_OPEN => 'File was opened',
  10. IN_MOVED_TO => 'File moved into watched directory',
  11. IN_MOVED_FROM => 'File moved out of watched directory',
  12. IN_CREATE => 'File or directory created in watched directory',
  13. IN_DELETE => 'File or directory deleted in watched directory',
  14. IN_DELETE_SELF => 'Watched file or directory was deleted',
  15. IN_MOVE_SELF => 'Watch file or directory was moved',
  16. IN_CLOSE => 'Equals to IN_CLOSE_WRITE | IN_CLOSE_NOWRITE',
  17. IN_MOVE => 'Equals to IN_MOVED_FROM | IN_MOVED_TO',
  18. IN_ALL_EVENTS => 'Bitmask of all the above constants',
  19. IN_UNMOUNT => 'File system containing watched object was unmounted',
  20. IN_Q_OVERFLOW => 'Event queue overflowed (wd is -1 for this event)',
  21. IN_IGNORED => 'Watch was removed (explicitly by inotify_rm_watch() or because file was removed or filesystem unmounted',
  22. IN_ISDIR => 'Subject of this event is a directory',
  23. IN_ONLYDIR => 'Only watch pathname if it is a directory',
  24. IN_DONT_FOLLOW => 'Do not dereference pathname if it is a symlink',
  25. IN_MASK_ADD => 'Add events to watch mask for this pathname if it already exists',
  26. IN_ONESHOT => 'Monitor pathname for one event, then remove from watch list.',
  27. 1073741840 => 'High-bit: File not opened for writing was closed',
  28. 1073741856 => 'High-bit: File was opened',
  29. 1073742080 => 'High-bit: File or directory created in watched directory',
  30. 1073742336 => 'High-bit: File or directory deleted in watched directory',
  31. ];
  32. const MONITOR_EVENT = IN_CLOSE_WRITE;
  33. }