-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[2.2] [WIP] ResourceWatcher component refactored #3961
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
this is a basic state checker, which checks all files and directories recursively for changes
this resources tracker uses recursive iterator state checker internally
if no tracker were specified in watcher constructor it will use best one (inotify if available and rec otherwise)
…istent with other parts of the framework.
…FilteredChilds method
[ResourceWatcher] Few small issues
Makes sure that directory and the file resources with the same name will have different ids
file resource existence check shouldn't return true if there's directory with same name instead of file.
@everzet this PR conflicts with master according to github |
@@ -63,3 +63,12 @@ | |||
|
|||
system(sprintf('cd %s && git fetch origin && git reset --hard %s', escapeshellarg($installDir), escapeshellarg($rev))); | |||
} | |||
|
|||
// install inotify extension | |||
system(<<<SH |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should wrap this call as it will fail for Windows users, making the vendors script unusable.
Btw, is it really necessary ? Travis uses Composer now in master
@fabpot what about merging the changes done in the ResourceInterface into 2.1 to allow marking the Config component as stable instead of waiting for 2.2 to do it because of this PR ? |
yep, it passes
I think the RecursiveIteratorTracker is great. I'm out of ideas how to break it. |
@everzet why not forcing the push in the branch to update the PR ? |
@stof to not break history of this PR. i'm thinking about opening another PR instead. |
], | ||
"require": { | ||
"php": ">=5.3.3" | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the component requires symfony/config
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think @stofbot is right. This component does depends on symfony/config
...
…ames [ResourceWatcher] Resource watcher tests and event names
@everzet feel free to remove the IN_ prefix. |
rebased to #4605 |
REBASED TO #4605
Bug fix: no
Feature addition: yes
Backwards compatibility break: no
Symfony2 tests pass: yes (for old tests) and partly (InotifyTracker is not yet finished)
Fixes the following tickets: -
This is refactoring of #391, which:
EventDispatcher
component for events routinginotify
naming convention for event types (IN_CREATE
,IN_MODIFY
,IN_DELETE
).Short overview
This component is here for tracking filesystem changes. You're registering directory or file resources to track with specific track name (
tracking_id
) andstart()
watcher. Watcher checks for FS changes after specific timespan and if some change occur (file/directory create/update/delete) - watcher dispatchesEventDispatcher
event withresource_watcher.all
,resource_watcher.tracking_id
names andFilesystemEvent
as argument.Usage
Simplest possible way of FS tracking
Simplest tracking code would look like this:
best suitable
Tracker
andEventDispatcher
would be instantiated for you, implicitlytrack()
methodExtended usage looks like that:
addListener()
methodIf you don't want to deal with
EventDispatcher
,ResourceWatcher
can hide this detail for you:WIP
InotifyTracker
is not ready as i have problems testing it (no Inotify on MacOS). Help here would be highly appreciated - test suite is ready, requirement is to makeInotifyTrackerTest
green.