-
Notifications
You must be signed in to change notification settings - Fork 60
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
Add --defaults
flag to allow loading of MySQL configuration
#157
Conversation
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.
Awesome work, this does what it should while keeping things consistent.
I have a few nitpicks I added as review comments. All of these apply to every instance of their corresponding usage across all sub commands, of course.
Also, I understand you were using private static
for the helper method to keep with the current conventions. However, I intend to change some of these conventions that I "inherited"... ;)
Co-Authored-By: Alain Schlesser <alain.schlesser@gmail.com>
Co-Authored-By: Alain Schlesser <alain.schlesser@gmail.com>
Co-Authored-By: Alain Schlesser <alain.schlesser@gmail.com>
@schlessera, I do believe I've addressed all your concerns. Per the static method issue, I had shared the concern but went with the existing paradigm. The new fixes change that but, note, also required a change to another private static method that had been calling the flags method. All tests still work, but I did want to call that out just in case. Please let me know if you find any further issues. |
@schlessera, thank you for the clarification on the negation of flags. I didn't realize that from your initial comment. I've updated the flag login and added tests as appropriate. |
@ChrisWiegman The PR works now and does what it should, thanks for keeping at it! When opening it up in PHPStorm (and seeing more of the big picture of the file than here in the GitHub PR view), I realized that the file currently is a mess in terms of how it handles MySQL arguments, with one command passing all of them through, most others passing a subset, ... As this is not directly related to your PR, I'll merge yours now, and then create a separate one to refactor a bit, so don't be surprised if I'm immediately swapping things around again after this was merged. (Note to self: I should always open PRs in PHPStorm. It seems so convenient to only look in here, but you easily miss the bigger problems as large parts are just hidden by GH) |
--defaults
flag to allow loading of MySQL configuration
Thanks for the PR, @ChrisWiegman ! |
This fix addresses issue #155
The Problem
The
--no-defaults
flag tells MySQL to ignore all .cnf files passed to it. While this works great in many situations, there are scenarios where it can break MySQL such as when the .cnf specifies an alternative socket file or other environment specific configuration items.The Proposed Solution
This PR, after talking with @schlessera, fixes the issue by re-introducind the
--defaults
flag to the wp db command. When present, the --no-defaults flag normally passed to all MySQL commands is removed thereby allowing MySQL to make use of the MYSQL_HOME or other config variables.