Activity Log: make it a toggleable Jetpack module#49591
Conversation
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! Jetpack plugin: The Jetpack plugin has different release cadences depending on the platform:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
Code Coverage SummaryCoverage changed in 2 files.
1 file is newly checked for coverage.
Full summary · PHP report · JS report If appropriate, add one of these labels to override the failing coverage check:
Covered by non-unit tests
|
Fixes #
Proposed changes
Activity Log is currently always on for every connected site, with no way to turn it off. This makes it a standard Jetpack module so it can be activated/deactivated like Stats, Monitor, etc. When deactivated, its sidebar entry disappears.
activity-logmodule (projects/plugins/jetpack/modules/activity-log.php) that bootstraps the existingjetpack-activity-logpackage. Header isAuto Activate: Yes/Requires (User) Connection: Yes/Feature: Security, so it stays on by default.Activity_Log_Init::initialize()call (and its now-unusedusealias) fromJetpack::late_initialization()inclass.jetpack.php. The module file is now the single entry point, so the package only initializes — and the sidebar item is only registered — while the module is active.Backwards compatibility:
Auto Activate: Yesmakes this a default module, so existing connected sites auto-activate it via the normal version-upgrade routine (activate_default_modules) and new sites get it on connection. No behavior change for anyone who does nothing — they just gain the ability to turn it off.Scope note: this gates the native (self-hosted) Activity Log menu + init only. The WPCOM/Atomic
wpcom-admin-menu.phpoverride (which links towordpress.com/activity-log/) is intentionally left untouched.Minor pre-existing follow-up (not addressed here): the Jetpack AI page links to
admin.php?page=jetpack-activity-log; with the module off that link points at a disabled page. Worth gating in a follow-up.Related product discussion/links
Does this pull request change what data or activity we track or use?
No. This only changes whether the existing Activity Log feature is loaded; it adds no new tracking.
Testing instructions
On a connected, non-multisite, self-hosted site (the native path — a non-WoA Jurassic Ninja site works):
wp jetpack module deactivate activity-log(or via the modules admin page).admin.php?page=jetpack-activity-logis no longer registered. No PHP errors.wp jetpack module activate activity-log— the sidebar item returns.Headless verification (no browser needed): with the module active,
has_action( 'admin_menu', [ Automattic\Jetpack\Activity_Log\Jetpack_Activity_Log::class, 'add_wp_admin_submenu' ] )returns a priority; with it inactive it returnsfalse.Note: if a freshly-added module shows as "not a valid module" via WP-CLI, clear the version-keyed cache with
wp eval 'Jetpack_Options::delete_option("available_modules");'(WP-CLI runs non-admin and won't refresh it automatically; a normal admin page load does).