/** * 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; }
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); }
public function unwatch(TrackedObject $tracked) { $this->log('Unwatch tracked object', array('path' => realpath($tracked->getResource()), LogLevel::DEBUG)); }
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); }