-
Notifications
You must be signed in to change notification settings - Fork 63
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
Don't hardcode MySQL command names, part 2 #280
base: main
Are you sure you want to change the base?
Conversation
this doesn't work as we would hope because:
just calls the The problem is that because mariadb has decided to deprecate calling mysql, we would need to have a way to determine what binary to call before we call one at all. So this will need some thinking as the best way to do that (and then replace the very many uses of mysql in wp-cli so it probably should be in the wp cli project itself). A simple way is to just assume if mariadb is there to prefer that instead -- but im not sure how accurate that might be. Or to add a new environment variable that lets the user decide? |
Right... 🤔 💡 So basically we need
Not sure if there are really that many, see https://github.com/search?q=org%3Awp-cli+%22%2Fusr%2Fbin%2Fenv+mysql%22&type=code
The former could have some unexpected results if suddenly a different binary is used. So the latter seems safer. |
Yea I think something like that is needed! I'm not sure if it is common to have both mariadb and mysql installed -- but even with the deprecated So really the problem is on a system that is going to have both a mariadb and mysql binary, what steps do we take to determine the one to use? Is it safe enough to assume that since mariadb provides a mysql binary, but mysql doesn't provide a mariadb binary, that pretty much any case of both existing are going to be a mariadb install? Maybe a more general get_db_type() check that could include sqlite as well? I don't think we have anything like that but it would be a good first step for either fixing or giving better error messages for most of the commands in this repo .. |
This comment was marked as resolved.
This comment was marked as resolved.
^ @schlessera any thoughts on the above suggestion and the issue at hand? |
Perhaps we could do this:
This way there shouldn't be any breaking change.
We could check for SQLite support depending on the |
Now tests fail because |
Probably something like this needed going forward: db-command/features/db-check.feature Line 131 in 19b2555
|
Yeah good point… So I should not use the fully resolved cmd path to make that work, but still |
This is a follow-up to #275 which addressed the
mysqlcheck
andmysqldump
usage, but not usage ofmysql
itself.There was a suggestion to move this utility to the main framework (maybe updating
Utils/get_mysql_binary_path()
?) which we could do in a future step.Then, we could also add a
get_db_type()
util or so to avoid repeating( strpos( Utils\get_mysql_version(), 'MariaDB' ) !== false )
everywhere.