diff --git a/projects/packages/jetpack-mu-wpcom/changelog/pcg-guard-activation-default-true b/projects/packages/jetpack-mu-wpcom/changelog/pcg-guard-activation-default-true new file mode 100644 index 00000000000..7ffa953a5b0 --- /dev/null +++ b/projects/packages/jetpack-mu-wpcom/changelog/pcg-guard-activation-default-true @@ -0,0 +1,4 @@ +Significance: minor +Type: changed + +Plugin Conflicts Guardian: pcg_guard_activation now defaults to true, enabling the activation probe and install/update parse-error gate by default. diff --git a/projects/packages/jetpack-mu-wpcom/src/features/plugin-conflicts-guardian/README.md b/projects/packages/jetpack-mu-wpcom/src/features/plugin-conflicts-guardian/README.md index 4202a52bf9a..a3cdd389901 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/plugin-conflicts-guardian/README.md +++ b/projects/packages/jetpack-mu-wpcom/src/features/plugin-conflicts-guardian/README.md @@ -2,10 +2,10 @@ Pre-flight plugin-activation check. When an admin clicks Activate (or finishes an Upload Plugin install), this feature loads the plugin in an isolated HTTP request and refuses the activation if that probe captures a fatal — the site stays up instead of entering recovery mode. -Ships dark. Three independent filters, all default `false`: +Two independent filters: -- `pcg_guard_activation` — enables the activation probe and the syntax-only install/update gate. -- `pcg_guard_updates` — enables the post-update health check + rollback flow. +- `pcg_guard_activation` — enables the activation probe and the syntax-only install/update gate. Defaults `true`. +- `pcg_guard_updates` — enables the post-update health check + rollback flow. Defaults `false`. ## Files diff --git a/projects/packages/jetpack-mu-wpcom/src/features/plugin-conflicts-guardian/activation-guard.php b/projects/packages/jetpack-mu-wpcom/src/features/plugin-conflicts-guardian/activation-guard.php index 441ca8f3a6f..0458258d1ed 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/plugin-conflicts-guardian/activation-guard.php +++ b/projects/packages/jetpack-mu-wpcom/src/features/plugin-conflicts-guardian/activation-guard.php @@ -15,7 +15,7 @@ * plugin being activated and redirects with a notice on any failure. */ function pcg_guard_maybe_block_activation() { - if ( ! apply_filters( 'pcg_guard_activation', false ) ) { + if ( ! apply_filters( 'pcg_guard_activation', true ) ) { return; } if ( ! current_user_can( 'activate_plugins' ) ) { diff --git a/projects/packages/jetpack-mu-wpcom/src/features/plugin-conflicts-guardian/probe-endpoint.php b/projects/packages/jetpack-mu-wpcom/src/features/plugin-conflicts-guardian/probe-endpoint.php index 8e7a5f62f9e..d8b606712f1 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/plugin-conflicts-guardian/probe-endpoint.php +++ b/projects/packages/jetpack-mu-wpcom/src/features/plugin-conflicts-guardian/probe-endpoint.php @@ -49,8 +49,10 @@ function pcg_maybe_handle_probe() { // Gate per mode: activation probes need pcg_guard_activation, update // probes need pcg_guard_updates. Otherwise enabling either flow would // pull in the other as an unintended dependency. - $gate_filter = PCG_Load_Tester::MODE_UPDATE === $mode ? 'pcg_guard_updates' : 'pcg_guard_activation'; - if ( ! apply_filters( $gate_filter, false ) ) { + $is_update_mode = PCG_Load_Tester::MODE_UPDATE === $mode; + $gate_filter = $is_update_mode ? 'pcg_guard_updates' : 'pcg_guard_activation'; + $gate_default = ! $is_update_mode; + if ( ! apply_filters( $gate_filter, $gate_default ) ) { pcg_probe_bail_error( 'Plugin Conflicts Guardian is disabled.', 403 ); } diff --git a/projects/packages/jetpack-mu-wpcom/src/features/plugin-conflicts-guardian/update-guard.php b/projects/packages/jetpack-mu-wpcom/src/features/plugin-conflicts-guardian/update-guard.php index c1f8ca1c936..d629fde5099 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/plugin-conflicts-guardian/update-guard.php +++ b/projects/packages/jetpack-mu-wpcom/src/features/plugin-conflicts-guardian/update-guard.php @@ -32,7 +32,7 @@ function pcg_update_guard_check( $source, $remote_source, $upgrader, $hook_extra if ( is_wp_error( $source ) ) { return $source; } - if ( ! apply_filters( 'pcg_guard_activation', false ) ) { + if ( ! apply_filters( 'pcg_guard_activation', true ) ) { return $source; } $type = $hook_extra['type'] ?? '';