Skip to content

Conversation

@michaelw85
Copy link
Contributor

@michaelw85 michaelw85 commented Jun 6, 2025

Add mysql SSL flag, resolves #113

Note: This implementation differs from the one in wordpress-core/wp-includes/class-wpdb.php where it takes a constant as flags. This seems a bit over complicated to use compared to using a --ssl flag on the cli.

I tested this change locally by creating a new user and forcing ssl using alter user 'my_user'@'localhost' REQUIRE SSL;
I want to add a behat test but I don't know where the DB is prepared and if I can add a user to it with forced SSL.

@michaelw85 michaelw85 requested a review from a team as a code owner June 6, 2025 13:06
@codecov
Copy link

codecov bot commented Jul 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@swissspidy
Copy link
Member

@michaelw85 I think the issue is that ... IF NOT EXISTS isn't supported on that older MySQL version.

@michaelw85
Copy link
Contributor Author

@michaelw85 I think the issue is that ... IF NOT EXISTS isn't supported on that older MySQL version.

Yes I finally figured that out 😓 I'm looking at other options. There's no option to skip this MySQL version yet looking at the code.

@swissspidy
Copy link
Member

We could set up this second user more centrally in our wp-cli-tests package: https://github.com/wp-cli/wp-cli-tests/blob/main/bin/install-package-tests

@michaelw85
Copy link
Contributor Author

We could set up this second user more centrally in our wp-cli-tests package: https://github.com/wp-cli/wp-cli-tests/blob/main/bin/install-package-tests

That might be an easy fix, but I don't think a lot of tests would be done with this user apart from this specific scenario.
Is there a way to conditionally skip this test for 5.6?

@michaelw85
Copy link
Contributor Author

@swissspidy Added wp-cli/wp-cli-tests#266 to make it possible to set minimum mysql requirements

@swissspidy
Copy link
Member

@michaelw85 I just tagged v5.0.1 of wp-cli/wp-cli-tests 👍

@michaelw85
Copy link
Contributor Author

@swissspidy Tests are finally green. First I added the 5.7 mysql requirement tag, but I also have to add the plain @require-mysql which I didn't expect. I assume there's a different piece of code that determines the include part of the behat tags I haven't touched. I don't have time right now but I think this should be updated to match other tag behavior.

@swissspidy swissspidy added this to the 2.4.0 milestone Jul 28, 2025
@swissspidy swissspidy merged commit a7e8885 into wp-cli:main Jul 28, 2025
43 checks passed
@michaelw85 michaelw85 deleted the 113_add_ssl_flag branch July 28, 2025 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DB-Check fails if Database requires SSL

2 participants