Phase out Cron API
Bug Description
The \Google\Site_Kit\Core\Util\Cron class is a relic of an earlier implementation of the plugin and no longer serves a useful purpose. Currently the only module which is using it is the PageSpeed Insights module. Functionally, the cron that runs is not providing any benefit since the data that is fetched in the background is not cached.
This class and its use is to be phased out and removed, per @felixarntz .
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
- Ensure no fatal error occurs during basic plugin usage and particularly during setup and usage of the PSI module.
Implementation Brief
- Delete
\Google\Site_Kit\Core\Util\Cron - Remove usage of filters provided from modules
googlesitekit_cron_daily_requestsgooglesitekit_cron_hourly_requests
- Register actions in
Pluginfor site kit cron hooks that unschedule the event (avoids the need to check for if scheduled on every request)googlesitekit_cron_dailygooglesitekit_cron_hourly
- Register action on
googlesitekit_deactivationinPluginto ensure cron events are unscheduled if deactivated before event runs - Note added actions for cleanup are to be removed in a future release
- Update tests accordingly
- No
Crontest to delete - Update
PluginTestto test added hooks
- No
Changelog entry
- N/A
Assigning to @aaemnnosttv to write the implementation brief. Many thanks!
Ready for brief review.
@aaemnnosttv Since we are in developer beta, I'd say it's okay if we remove the class right away (although I like your BC approach in general). We could probably make the call to remove old scheduled hooks manually in the Plugin main class and not rely on the Cron class (leaves us only with little legacy overhead). Let me know if you think that's feasible.
Either way we have code to be removed later but I think your suggestion sounds a bit cleaner with more we can remove now and less to remove later 👍
Updating the brief now.
@felixarntz I've updated the brief, so this is ready for your review again.
@aaemnnosttv Implementation brief looks good. I just merged the Plugin tests, so those can be updated as part of this as well now.
Great, I just updated the IB to note that PluginTest will be updated 👍
QA looking good!