@@ -63,52 +63,52 @@ class FileSystemWatcher
6363 *
6464 * @var string
6565 */
66- private $ _path ;
66+ private $ _path = " ./ " ;
6767
6868 /**
6969 * Define if we are watching changes
7070 * recursively.
7171 *
7272 * @var bool
7373 */
74- private $ _recursive ;
74+ private $ _recursive = true ;
7575
7676 /**
7777 * The regex pattern of files and folders to watch.
7878 *
7979 * @var string
8080 */
81- private $ _patternInclude ;
81+ private $ _patternInclude = " /^.*$/U " ;
8282
8383 /**
8484 * The regex pattern of files and folders
8585 * to excludes from watching.
8686 *
8787 * @var string
8888 */
89- private $ _patternExclude ;
89+ private $ _patternExclude = "" ;
9090
9191 /**
9292 * The number of milliseconds to wait before
9393 * watch for changes.
9494 *
9595 * @var integer
9696 */
97- private $ _watchInterval ;
97+ private $ _watchInterval = 1000000 ;
9898
9999 /**
100100 * Defines if the watcher is started and running.
101101 *
102102 * @var bool
103103 */
104- private $ _started ;
104+ private $ _started = false ;
105105
106106 /**
107107 * Defines if the watcher is built.
108108 *
109109 * @var bool
110110 */
111- private $ _built ;
111+ private $ _built = false ;
112112
113113 /**
114114 * Stores the list of files in the watched
@@ -141,7 +141,6 @@ class FileSystemWatcher
141141 public function __construct (FireFS &$ fs )
142142 {
143143 $ this ->_fs = $ fs ;
144- $ this ->_watchInterval = 1000000 ;
145144 }
146145
147146 /**
@@ -253,13 +252,23 @@ public function start()
253252 $ this ->_started = true ;
254253
255254 while ($ this ->_started ) {
256- clearstatcache (true );
257- $ this ->_detectChanges ();
258- $ this ->_cacheLastModTimes ();
255+ $ this ->process ();
259256 usleep ($ this ->_watchInterval );
260257 }
261258 }
262259
260+ /**
261+ * Process a watch
262+ *
263+ * @return void
264+ */
265+ public function process ()
266+ {
267+ clearstatcache (true );
268+ $ this ->_detectChanges ();
269+ $ this ->_cacheLastModTimes ();
270+ }
271+
263272 /**
264273 * Stop the file system watcher.
265274 *
0 commit comments