Watcher plugin fixes

* com.noccy.watcher: Initial inotify support
* ScriptRunner now accepts an array of local vars for expansion
  when evaluating scripts
This commit is contained in:
2021-12-15 03:47:39 +01:00
parent 30dfd4889b
commit 1125ccb82d
5 changed files with 135 additions and 12 deletions

View File

@ -60,12 +60,13 @@ class MtimeMonitor implements MonitorInterface
}
foreach ($check as $path) {
if (!file_exists($path)) continue;
if (empty($this->watched[$path])) {
$this->watched[$path] = filemtime($path);
} else {
$mtime = filemtime($path);
if ($mtime > $this->watched[$path]) {
printf("* modified: %s (%s)\n", $path, $rule->getName());
printf("~ modified: %s (%s)\n", $path, $rule->getName());
$this->watched[$path] = $mtime;
if (!in_array($rule, $this->modified)) {
$this->modified[] = $rule;