Ejemplo n.º 1
0
 public function onFileChanged($path)
 {
     if (!Daemon::lintFile($path)) {
         Daemon::log(__METHOD__ . ': Detected parse error in ' . $path);
         return;
     }
     foreach ($this->files[$path] as $k => $subscriber) {
         if (is_callable($subscriber) || is_array($subscriber)) {
             call_user_func($subscriber, $path);
             continue;
         }
         if (!isset(Daemon::$process->workers->threads[$subscriber])) {
             unset($this->files[$path][$k]);
             continue;
         }
         $worker = Daemon::$process->workers->threads[$subscriber];
         if (Daemon::$config->autoreimport->value) {
             if ($worker->connection) {
                 $worker->connection->sendPacket(array('op' => 'importFile', 'path' => $path));
             }
         } else {
             $worker->signal(SIGUSR2);
         }
     }
 }