-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
Improve handling of xhprof_prepend.php
#28
Improve handling of xhprof_prepend.php
#28
Conversation
9539519
to
40b6db1
Compare
40b6db1
to
118cae3
Compare
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.
Great idea! 👏
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.
Minor changes, suggesting cp
if that is easy for you.
Overall, I'm still not even happy that we mount the prepend file and think we should be doing something better in DDEV rather than working around it. But here we are, so this approach is definitely an improvement.
config.xhgui.yaml
Outdated
// We'll temporarily override it here, but return control back later. | ||
// If you don't want this behavior, comment out the hooks in ".ddev/config.xhgui.yaml". | ||
return; | ||
PHP |
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.
This line would be easier to understand if it were just the traditional EOF
or maybe PHP_EOF
. Caught me by surprise. Not that important of course.
config.xhgui.yaml
Outdated
hooks: | ||
post-start: | ||
- exec: | | ||
cat <<-PHP > .ddev/xhprof/xhprof_prepend.php |
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.
Wouldn't it be easier to use a cp
here instead of cat? Then it's also one line.
config.xhgui.yaml
Outdated
PHP | ||
pre-stop: | ||
- exec: | | ||
cat <<-PHP > .ddev/xhprof/xhprof_prepend.php |
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.
Same, wouldn't cp
be easier?
- commands/host/xhgui | ||
- xhgui/Dockerfile | ||
- xhgui/xhgui.config.php | ||
- xhgui/collector/xhgui.collector.config.php | ||
- xhgui/collector/xhgui.collector.php | ||
- xhgui/nginx.conf | ||
- xhprof/xhprof_prepend.php |
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.
If you use cp
you'd still have this, it would just be indirectly installed.
The idea here was to avoid copying a file. I want to dynamically write out it. Because the file contents contains If we went with |
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 you should go ahead with this. It can be adjusted in the future.
Another technique is to use something like #xhgui-generated
in the text of the prepend file, and feel free to delete it (using removal_actions
) if it contains that. if grep '#xhgui-generated' <phpfile>; then rm <phpfile>; fi
0a22a26
to
d3c0644
Compare
Rebased. |
The default
xhpro_prepend.php
file that ships with recent flavors of DDEV is NOT compatible with this addon.Currently, we take ownership of it so this addon can function. However, we don't return ownership. This could cause problems if the addon is removed or disabled.
This PR offers a different approach.
post-start
hook to claim ownership.pre-stop
hook to return ownership.This handles ownership while the addon is active.
But returns ownership when stop; thus DDEV will return to "default" state next time it checks the file.
Fixes #11