Open jamesozzie opened 1 year ago
@aaemnnosttv tagging you here for visibility.
@aaemnnosttv Are you still planning to work on this soon? If not, could you please unassign yourself so someone else can pick it up? Thank you!
Closing in favor of #8988
I will comment on #8988 as well but I do not agree that this should be closed in favour of that issue.
As per WordPress WP Cron recommendations, tasks should be unscheduled when they are no-longer required and doing so on a deactivation hook (as recommended by WordPress) cannot have a detrimental effect because the plugin is no longer active!
Should the plugin be re-activated, the missing / required tasks will be added again by the plugin anyway.
Thanks @webd-uk, I agree, this issue is still valid 👍
Update
google-site-kit.php
- Include
register_uninstall_hook
function, and re-use thegooglesitekit_deactivate_plugin
as callback. You can invoke this function bellow theregister_deactivation_hook
, since uninstalling and deactivating can share the same cleanup logic.
@zutigrm it should be done in the includes/Core/Util/Uninstallation.php
file.
Update
Google\Site_Kit\Plugin::register
:
- Hook into
googlesitekit_deactivation
andgooglesitekit_reset
and remove all listed CRON events.
The same here, we should do it in the Uninstallation
class.
@eugene-manuilov Thanks! Didn't see we have that file. IB Updated
Thanks. IB ✔️
Bug Description
As suggested by a user in the forums, consider allowing users to remove any cron events upon via a hook, or an option to remove such events upon uninstall or deactivation.
The cron event highlighted by the user is
googlesitekit_cron_update_remote_features
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
Implementation Brief
OAuth_Client::CRON_REFRESH_PROFILE_DATA
Remote_Features_Cron:CRON_ACTION
Synchronize_AdSenseLinked::CRON_SYNCHRONIZE_ADSENSE_LINKED
Synchronize_AdsLinked:CRON_SYNCHRONIZE_ADS_LINKED
Synchronize_Property:CRON_SYNCHRONIZE_PROPERTY
includes/Core/Util/Uninstallation.php
register
method, hook intogooglesitekit_deactivation
andgooglesitekit_reset
and remove all listed CRON events. You can usewp_clear_scheduled_hook
.googlesitekit_uninstallation
hook as wellTest Coverage
QA Brief
conversionReporting
feature flag (as that includes one of the cron events).Changelog entry