Update Google PHP client services library to latest version (again)
See original GitHub issueSince the Idea Hub API is still being under development and sees frequent updates, we need to make sure we keep the Google API client services library up to date so that we can work with the latest version of that API intuitively.
Unfortunately it looks like the entire library was recently bumped to a 0.2xx
(see release notes), including a few substantial changes on the included code - so this update might not be super trivial. However, we shouldn’t have to deal with overall API changes like we had to before with AdSense (see #3517), so it’s still good we were able to do that separately.
Let’s update to the latest version of the library, so that we have the latest Idea Hub API client code and then are set up updating it again in the future more easily to keep up with the Idea Hub API.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
- The Google API client services PHP library should be updated to its latest version (
"google/apiclient-services": "^0.200"
incomposer.json
). - The Site Kit PHP code using this library should be updated to still work correctly with the high-level changes made in version 0.200.0.
- It also needs to be ensured that code is still properly included in the
third-party
directory via PHP-Scoper.
- It also needs to be ensured that code is still properly included in the
- From a QA perspective, this shouldn’t result in any user-facing change, but there should be thorough testing throughout all modules to avoid unexpected breakage. Preferably this should be merged as early as possible in a release cycle, so that enough organic testing can happen.
Implementation Brief
The goal here is to update the dependency, and load the site until it stops breaking, here’s the general approach to do this:
- Ensure you have the following in your
wp-config.php
- define( ‘WP_DEBUG’, true );
- define( ‘WP_DEBUG_LOG’, true );
- Update
composer.json
per AC (version bump) - Update the dependency
composer update "google/apiclient-services"
- Next you’ll need to update
scoper.inc.php
in several places to account for the updated paths:- https://github.com/google/site-kit-wp/blob/develop/scoper.inc.php#L74
- https://github.com/google/site-kit-wp/blob/develop/scoper.inc.php#L83
- One of the changes in the release is the move to psr-4 modules, so you’ll need to load the
autoload.php
file. https://github.com/googleapis/google-api-php-client-services/blob/master/autoload.php
- Next re-run
composer install
and try loading the site, if any errors appear, resolve those too.
Once the site is up and running, test setting up each module to ensure the API for them still works as expected to get data.
Test Coverage
- No new tests needed.
Visual Regression Changes
- N/A
QA Brief
- For engineering dev builds: install latest composer dependencies.
- Enable debug logging in WordPress
- Activate and use every module.
- Note any errors in debug.log, there shouldn’t be any.
Changelog entry
- Update Google PHP client services library to latest version
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (6 by maintainers)
@ivankruchkoff Good point, I agree with you we should go with option 2, keeping the real class names with simply a prefix. We can use aliasing where this causes issues.
QA Update: Pass ✅
Query Manager
andDebug Toolbar
enabled and no errors appeared when connecting the modules or using them, changing date periods, engaging with the data, i.e. pie charts, etc.I’ve made @cole10up aware of this so we will keep a look out through this sprint of any weird behaviour.