예제 #1
0
파일: Tracker.php 프로젝트: phpguard/listen
 /**
  * Add a new event to changeset
  *
  *@param TrackedObject $tracked
  * @param int             $eventMask
  */
 public function addChangeSet($tracked, $eventMask)
 {
     if ($tracked instanceof TrackedObject) {
         $path = $tracked->getResource();
         if ($this->fileOnly && !$tracked->getResource() instanceof FileResource) {
             return;
         }
     } else {
         $path = $tracked;
     }
     $event = new FilesystemEvent($path, $eventMask);
     $id = md5($path);
     $this->changeSet[$id] = $event;
 }
예제 #2
0
 function its_checkPath_should_track_on_filesystem_delete_event(AdapterInterface $adapter, FileResource $resource, TrackedObject $tracked)
 {
     $tracked->getResource()->shouldBeCalled()->willReturn($resource);
     $tracked->getChecksum()->shouldBeCalled()->willReturn('checksum');
     $resource->isExists()->shouldBeCalled()->willReturn(false);
     $resource->getChecksum()->willReturn('new_checksum')->shouldBeCalled();
     $resource->getResource()->willReturn($this->testFile);
     $adapter->unwatch($tracked)->shouldBeCalled();
     $this->checkPath($this->testFile);
     $this->getChangeSet()->shouldHaveCount(1);
 }
예제 #3
0
 public function unwatch(TrackedObject $tracked)
 {
     $this->log('Unwatch tracked object', array('path' => realpath($tracked->getResource()), LogLevel::DEBUG));
 }
예제 #4
0
 public function unwatch(TrackedObject $tracked)
 {
     if ($tracked->getResource()->isExists()) {
         return;
     }
     @inotify_rm_watch($this->inotify, $tracked->getID());
     unset($this->inotifyMap[$tracked->getID()]);
     return parent::unwatch($tracked);
 }