-
Notifications
You must be signed in to change notification settings - Fork 22
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
Issue #181 - Fixes failure of database functions if special characters used #183
Conversation
Tested on host. |
Tested this with the lando recipe
PHPUnit 8.5.26 #StandWithUkraine
Bee Core Cache Commands Config Commands Cron Commands DBCommands DBLog Commands Download Commands Help Commands PHPCommands Projects Commands Update Commands User Commands Time: 49.68 seconds, Memory: 10.00 MB OK (30 tests, 89 assertions) Multisite Multisite Install Commands Multisite Download Commands Time: 16.71 seconds, Memory: 10.00 MB OK (3 tests, 20 assertions) Also tested on host and this now works with complex password both auto and interactively. |
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.
Thanks @yorkshire-pudding. It took me a while to get my head around all this. Mainly because I didn't notice at first the different places where you used rawurlencode()
and rawurldecode()
(I thought they were all decoding, and that threw me for a while). But finally worked it out and now left some comments/requested changes for you.
@BWPanda - As per our discussion, I've changed the code to split the database settings. I've also changed the test (multi-site) where it uses this command. I've run tests using the updated lando recipe:
PHPUnit 8.5.26 #StandWithUkraine
Bee Core Cache Commands Config Commands Cron Commands DBCommands DBLog Commands Download Commands Help Commands PHPCommands Projects Commands Update Commands User Commands Time: 41.96 seconds, Memory: 10.00 MB OK (30 tests, 89 assertions) Multisite Multisite Install Commands Multisite Download Commands Time: 15.69 seconds, Memory: 10.00 MB OK (3 tests, 20 assertions) |
@BWPanda - please can you review the latest commit |
It's on my to do list. |
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.
A few things to change please.
Thanks @BWPanda for your feedback. I've implemented these. |
@BWPanda - Done those. Regarding checking the db name, are there any general principles about when you would test once and store in a variable versus checking the same test each time? I'm learning plenty, but sometimes I can't see why one approach would be favoured over another and would like to understand more. |
@yorkshire-pudding I understand where you're coming from. If it were performing a DB query or reading from config files, then yes, doing that once and then storing the value in a local variable would be better. But in this case, checking the DB name is just checking a variable (albeit an array rather than a string), so there's no real benefit storing this value in a second variable for later. Hope that makes sense...? |
Thanks. That's a good explanation. Makes sense. |
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.
Sorry, looking more closely I found a few more things to change.
Hi @BWPanda - I have done those. |
Hey @BWPanda and/or @yorkshire-pudding 👋🏼 ...I've noticed that this was missed when merging #183
Fixes #181 - Database functions fail if db_password contains special characters
Used the
rawurlencode
andrawurldecode
that core usesI've tested using the lando recipe in the module and they all pass (details below).
Bee Core
✔ Bee is installed correctly
✔ Unknown command triggers an error
✔ Missing required argument triggers an error
✔ Commands can be called via an alias
✔ Root global option works
✔ Yes global option works
✔ Debug global option works
Cache Commands
✔ Cache clear command works
Config Commands
✔ Config get command works
✔ Config set command works
✔ Config export command works
✔ Config import command works
Cron Commands
✔ Cron command works
DBCommands
✔ Db export command works
✔ Db import command works
DBLog Commands
✔ Log command works
Download Commands
✔ Download command works
✔ Download core command works
Help Commands
✔ Help command works
PHPCommands
✔ Eval command works
Projects Commands
✔ Projects command works
✔ Enable command works
✔ Disable command works
✔ Uninstall command works
✔ Theme default command works
✔ Theme admin command works
Update Commands
✔ Update db command works
User Commands
✔ Users command works
✔ User password command works
✔ User login command works
Time: 43.26 seconds, Memory: 10.00 MB
OK (30 tests, 89 assertions)
PHPUnit 8.5.26 #StandWithUkraine
Multisite
✔ Site global option works
Multisite Install Commands
✔ Install command works
Multisite Download Commands
✔ Download command works
Time: 15.84 seconds, Memory: 10.00 MB
OK (3 tests, 20 assertions)
Perhaps this needs some dedicated tests writing?
I'll try and test on my hosting where I can more easily set a complex password than in lando