From d7b76e9fc7946befa791ab2e84191131e77b7e6a Mon Sep 17 00:00:00 2001 From: Jeremy Herve Date: Wed, 24 Apr 2024 15:16:10 +0200 Subject: [PATCH] General: remove backwards-compatible code for versions < 6.4 (#37049) Epic: #33615 --- .../connection/changelog/update-rm-63-code | 4 ++++ .../connection/src/sso/class-user-admin.php | 15 +-------------- .../plugins/jetpack/changelog/update-rm-63-code | 4 ++++ .../modules/sso/class.jetpack-sso-user-admin.php | 15 +-------------- 4 files changed, 10 insertions(+), 28 deletions(-) create mode 100644 projects/packages/connection/changelog/update-rm-63-code create mode 100644 projects/plugins/jetpack/changelog/update-rm-63-code diff --git a/projects/packages/connection/changelog/update-rm-63-code b/projects/packages/connection/changelog/update-rm-63-code new file mode 100644 index 0000000000000..fd0162a894e54 --- /dev/null +++ b/projects/packages/connection/changelog/update-rm-63-code @@ -0,0 +1,4 @@ +Significance: patch +Type: changed + +General: remove code that was added to remain compatible with versions of WordPress lower than 6.4. diff --git a/projects/packages/connection/src/sso/class-user-admin.php b/projects/packages/connection/src/sso/class-user-admin.php index c1d0f63b599c9..a0b5b2bf9e637 100644 --- a/projects/packages/connection/src/sso/class-user-admin.php +++ b/projects/packages/connection/src/sso/class-user-admin.php @@ -151,16 +151,13 @@ public function revoke_user_invite( $user_id ) { /** * Renders invitations errors/success messages in users.php. - * - * @phan-suppress PhanUndeclaredFunction,UnusedSuppression -- Existence of wp_admin_notice (added in WP 6.4) is checked inline. - * @todo Remove suppression and function_exists check when we drop support for WP 6.3. */ public function handle_invitation_results() { $valid_nonce = isset( $_GET['_wpnonce'] ) ? wp_verify_nonce( sanitize_key( $_GET['_wpnonce'] ), 'jetpack-sso-invite-user' ) : false; - if ( ! $valid_nonce || ! isset( $_GET['jetpack-sso-invite-user'] ) || ! function_exists( 'wp_admin_notice' ) ) { + if ( ! $valid_nonce || ! isset( $_GET['jetpack-sso-invite-user'] ) ) { return; } if ( $_GET['jetpack-sso-invite-user'] === 'success' ) { @@ -610,10 +607,6 @@ public function jetpack_user_table_row_actions( $actions, $user_object ) { * Render the invitation email message. */ public function render_invitation_email_message() { - // @todo Remove function_exists check (and phan suppression below) when we drop support for WP 6.3. - if ( ! function_exists( 'wp_admin_notice' ) ) { - return; - } $message = wp_kses( __( 'We highly recommend inviting users to join WordPress.com and log in securely using Secure Sign On to ensure maximum security and efficiency.', @@ -628,7 +621,6 @@ public function render_invitation_email_message() { ), ) ); - // @phan-suppress-next-line PhanUndeclaredFunction -- Existence of wp_admin_notice (added in WP 6.4) is checked above. @phan-suppress-current-line UnusedPluginSuppression wp_admin_notice( $message, array( @@ -644,10 +636,6 @@ public function render_invitation_email_message() { * Render a note that wp.com invites will be automatically revoked. */ public function render_invitations_notices_for_deleted_users() { - // @todo Remove function_exists check (and phan suppression below) when we drop support for WP 6.3. - if ( ! function_exists( 'wp_admin_notice' ) ) { - return; - } check_admin_referer( 'bulk-users' ); // When one user is deleted, the param is `user`, when multiple users are deleted, the param is `users`. @@ -686,7 +674,6 @@ function ( $user_id ) { ), array( 'strong' => true ) ); - // @phan-suppress-next-line PhanUndeclaredFunction -- Existence of wp_admin_notice (added in WP 6.4) is checked above. @phan-suppress-current-line UnusedPluginSuppression wp_admin_notice( $message, array( diff --git a/projects/plugins/jetpack/changelog/update-rm-63-code b/projects/plugins/jetpack/changelog/update-rm-63-code new file mode 100644 index 0000000000000..38936866e08ef --- /dev/null +++ b/projects/plugins/jetpack/changelog/update-rm-63-code @@ -0,0 +1,4 @@ +Significance: patch +Type: compat + +General: remove code that was added to remain compatible with versions of WordPress lower than 6.4. diff --git a/projects/plugins/jetpack/modules/sso/class.jetpack-sso-user-admin.php b/projects/plugins/jetpack/modules/sso/class.jetpack-sso-user-admin.php index a1743333dcbbc..e566c7d620339 100644 --- a/projects/plugins/jetpack/modules/sso/class.jetpack-sso-user-admin.php +++ b/projects/plugins/jetpack/modules/sso/class.jetpack-sso-user-admin.php @@ -142,16 +142,13 @@ public function revoke_user_invite( $user_id ) { /** * Renders invitations errors/success messages in users.php. - * - * @phan-suppress PhanUndeclaredFunction,UnusedSuppression -- Existence of wp_admin_notice (added in WP 6.4) is checked inline. - * @todo Remove suppression and function_exists check when we drop support for WP 6.3. */ public function handle_invitation_results() { $valid_nonce = isset( $_GET['_wpnonce'] ) ? wp_verify_nonce( sanitize_key( $_GET['_wpnonce'] ), 'jetpack-sso-invite-user' ) : false; - if ( ! $valid_nonce || ! isset( $_GET['jetpack-sso-invite-user'] ) || ! function_exists( 'wp_admin_notice' ) ) { + if ( ! $valid_nonce || ! isset( $_GET['jetpack-sso-invite-user'] ) ) { return; } if ( $_GET['jetpack-sso-invite-user'] === 'success' ) { @@ -597,10 +594,6 @@ public function jetpack_user_table_row_actions( $actions, $user_object ) { * Render the invitation email message. */ public function render_invitation_email_message() { - // @todo Remove function_exists check (and phan suppression below) when we drop support for WP 6.3. - if ( ! function_exists( 'wp_admin_notice' ) ) { - return; - } $message = wp_kses( __( 'We highly recommend inviting users to join WordPress.com and log in securely using Secure Sign On to ensure maximum security and efficiency.', @@ -615,7 +608,6 @@ public function render_invitation_email_message() { ), ) ); - // @phan-suppress-next-line PhanUndeclaredFunction -- Existence of wp_admin_notice (added in WP 6.4) is checked above. @phan-suppress-current-line UnusedPluginSuppression wp_admin_notice( $message, array( @@ -631,10 +623,6 @@ public function render_invitation_email_message() { * Render a note that wp.com invites will be automatically revoked. */ public function render_invitations_notices_for_deleted_users() { - // @todo Remove function_exists check (and phan suppression below) when we drop support for WP 6.3. - if ( ! function_exists( 'wp_admin_notice' ) ) { - return; - } check_admin_referer( 'bulk-users' ); // When one user is deleted, the param is `user`, when multiple users are deleted, the param is `users`. @@ -673,7 +661,6 @@ function ( $user_id ) { ), array( 'strong' => true ) ); - // @phan-suppress-next-line PhanUndeclaredFunction -- Existence of wp_admin_notice (added in WP 6.4) is checked above. @phan-suppress-current-line UnusedPluginSuppression wp_admin_notice( $message, array(