-
Notifications
You must be signed in to change notification settings - Fork 805
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
Adding new managed WordPress hosts to be identified in class-functions.php. #14213
Conversation
Adding more hosting providers to get_hosting_provider() function to be able to identify managed WordPress hosts.
Thank you for the great PR description! When this PR is ready for review, please apply the Scheduled Jetpack release: January 14, 2020. |
Update get_hosting_provider() function to use an array of hosting provider constants to check the hosting provider
Adding in secondary check for class_exists for gd-managed-wp
Update variable name when returning the constant value to $hosting_provider
Update checking for managed WP hosts and adding tests for get_hosting_provider() function check.
This is looking pretty good to me. I agree with @tyxla's feedback on the the tests. Besides that, I wouldn't worry much about the Code Climate issue. It seems like it doesn't like the length of the method, but that may be difficult to fix and frankly, the method will continue to grow as we we add hosts in the future. I would suggest updating/removing the functional testing instructions since you've added test coverage. |
Splitting out hosting provider detection in to detection by specific types in separate functions which are now called by the main get_hosting_provider() function
Updating class functions to be non static and adding test for get_hosting_provider() for each method of getting a hosting provider
Updating the unit tests for get_hosting_provider() to be separate tests for each method that function calls and a test for unknown hosting providers from the get_hosting_provider() callable
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 LGTM. But, I'd like to get one other set of eyes on it as well.
@tyxla I've made some changes to this patch since your suggestion which was great by the way. Do you mind giving it a look over again? Thanks! |
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 looks good from my perspective 👍
I'd only suggest against the way that switch(true)
is used, but I don't have super strong feelings if y'all prefer it to be that way.
Update function get_hosting_provider_by_known_constant() to loop through known hosting provider constants in place of a switch
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 left a couple of comments, but they're not blockers. I like the change to use an array instead of a case for checking constants. It seems to have simplified the code quite a bit.
I think it's fine to not make the same change to the other methods for now at least. Instead, we can make that change if/when necessary, as we add more functions and classes to check.
@tyxla I had a comment from you in an email earlier today about an issue I think may have been resolved. Can you confirm? |
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 looks good to me! 👍
I can see some of the comments were marked as resolved but not addressed, but they were also not blockers. So feel free to 🚢 if it's all intended 👍 |
* [not verified] Remove empty readme section * Initial changelog for 8.2 * Changelog: add #14220 * Changelog: add #14252 * Changelog: add #14291 * Changelog: add #14309 * Changelog: add #14304 * Changelog: add general connection log. * Changelog: add #14275 * Changelog: add #14313 * Changelog: add #14213 * Changelog: add #14357 * Add sync testing instructions * Add 8.1.1 changelog back See eeaafab and 61757eb * Changelog: add #14371 * Changelog: add #14386 * Changelog: add #14471 * Changelog: add #14325 * Changelog: add #14194 * Changelog: add #14340 * Changelog: add #14418 * Changelog: add #14417 * Changelog: add #14075 * Changelog: add #14467 * Changelog: add #14307 * Changelog: add #14326
Adding more hosting providers to get_hosting_provider() function to be able to identify managed WordPress hosts.
Fixes N/A
Changes proposed in this Pull Request:
Is this a new feature or does it add/remove features to an existing part of Jetpack?
Testing instructions:
Proposed changelog entry for your changes: